lxw124 / -Test

算法
1 stars 0 forks source link

亲7数 #29

Open lxw124 opened 4 years ago

lxw124 commented 4 years ago

N%%(AHCFQ8CLT6KHIY~Z_D6

lxw124 commented 4 years ago
 function fn(data,num,n){
         if(num+1==n){
             var cur=0;
             for(var i=0;i<n;i++){
                 cur=cur*10+data[i]
             }
             if(cur%7==0){
                 count++;
             }
             return;
         }
         for(let j=num;j<n;j++){
          var temp=data[num]
          data[num]=data[j]
          data[j]=temp
           if(data[0]==0){
                 continue;
             }
             fn(data,num+1,n)
             var temp=data[num]
          data[num]=data[j]
          data[j]=temp
         }
     }