|
|
back to boardURGENT NEED HELP :( i don't know what's wrong with my program, it looks perfect but get WA #include<iostream.h> #define EOLN '\n' int res[37]; void main() { int k; int maxk = 2; char c; for (k=2; k<=36; k++) res[k] = 0; while ((c = cin.get())!=EOLN && c!=EOF) { for (k=maxk; k<=36; k++) { int a = 0; if ( c >= 'A' && c<= 'Z') a = c - 'A' + 10; if ( c >= '0' && c<= '9') a = c - '0'; if ( a > maxk - 1 ) maxk = a + 1; res[k] = (res[k]*k + a)%(k-1); } } for (k=maxk; k<=36; k++) if (res[k] == 0) break; if (k<=36) cout<<k<<endl; else cout<<"No Solution\n"; } That's simple! Just change "No Solution" to "No solution.", and you'll get AC. You should be very careful and attentive when reading the task. Good luck! |
|
|