cun
#include<cstdio> #include<cstring> int mark[15]; int main(){ int sum=0; for(int a=1;a<=9;a++){ if(mark[a]==0) mark[a]=1; else continue; sum+=a; printf("aaa1 %d\n",sum); for(int b=0;b<=9;b++){ if(mark[b]==0) mark[b]=1; else continue; sum=sum*10+b; printf("aaa2 %d\n",sum); for(int c=0;c<=9;c++){ if(mark[c]==0) mark[c]=1; else continue; sum=sum*10+c; for(int d=0;d<=9;d++){ if(mark[d]==0) mark[d]=1; else continue; sum=sum*10+d; for(int e=0;c<=9;e++){ if(mark[e]==0) mark[e]=1; else continue; sum=sum*10+e; for(int f=0;f<=9;f++){ if(mark[f]==0) mark[f]=1; else continue; sum=sum*10+f; printf("aaa%d\n",sum); // return 0; long long s=sum*sum; int flag=0; for(int i=0;s>0;i++){ if(mark[s%10]==1) { flag=1; break; } s/=10; } for(int i=0;i<=9;i++){ printf("%d ",mark[i]); } if(flag==0) printf("%d %lld\n",sum,s); sum/=10;mark[f]=0; } sum/=10;mark[e]=0; } sum/=10;mark[d]=0; } sum/=10;mark[c]=0; } sum/=10;mark[b]=0; } sum/=10;mark[a]=0; } return 0; }