标签:tail rar frog can int turn long mono ati
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 15066 Accepted Submission(s): 7946
//COPY #include<cstdio> #include<cstring> int f[30],target; int main(){ char s[30]; while(scanf("%d%s",&target,s)!=EOF&&target){ memset(f,0,sizeof(f)); if(strlen(s)<5){ printf("no solution"); break; } bool key=false; for(int i=0;i<strlen(s);i++) f[s[i]-‘@‘]=1; for(int a=26;a>0&&!key;a--) for(int b=26;b>0&&!key;b--){ if(b!=a) for(int c=26;c>0&&!key;c--){ if(c!=b&&c!=a) for(int d=26;d>0&&!key;d--){ if(d!=c&&d!=b&&d!=a) for(int e=26;e>0&&!key;e--){ if(e!=d&&e!=c&&e!=b&&e!=a) if(f[a]&&f[b]&&f[c]&&f[d]&&f[e]) if(a-b*b+c*c*c-d*d*d*d+e*e*e*e*e==target){ key=true; printf("%c%c%c%c%c\n",(char)a+64,(char)b+64,(char)c+64,(char)d+64,(char)e+64); } } } } } if(!key) printf("no solution\n"); } return 0; }
标签:tail rar frog can int turn long mono ati
原文地址:http://www.cnblogs.com/biggan/p/7435101.html