|
|
back to boardWhy WA?Who can help me? Posted by Frank 14 Aug 2014 22:38 int main(int argc,char *argv[]){ //freopen("data.txt","r",stdin); int n,i,key = 0,count = 0; char p[105],input[105]; scanf("%d",&n); getchar(); for(i = 0; i < n; i++){ scanf("%c",&input[i]); getchar(); } input[i] = '\0'; strcpy(p,input); while(next_permutation(p,p+n)){ if(strcmp(p,input) == 0){ break; } else { count++; if(count >= 5){ printf("Yes\n"); return 0; } } } if(count >= 5){ printf("Yes\n"); } else { printf("No\n"); } } Re: Why WA?Who can help me? count should be at least 6 :) |
|
|