|
|
back to board(help)i think my code is right,can you help me?(WA1) i think it will work out fine. But just got WA1. Can you help me ? thx! #include <cstdlib> #include <iostream> using namespace std;
int shu(int); int main(int argc, char *argv[]) { int a[10],b=0,max=0,d=0; while (cin>>a[b]) {if (a[b]==0) break; b++;} while (1) {if (a[d]==0) break; while (a[d]>=0) {if (shu(a[d])>max) max=shu(a[d]); a[d]--;} cout<<max<<endl; d++;}
system("PAUSE"); return EXIT_SUCCESS; }
int shu(int n) {int c; if (n==0) c=0; else if (n==1) c=1; else if (n%2==0) c=shu(n/2); else c=shu((n-1)/2)+shu((n-1)/2+1);} Re: (help)i think my code is right,can you help me?(WA1) I have the same trouble whit you,WA1!!! But I test it myself whit my computer but find nothing wrong! Re: (help)i think my code is right,can you help me?(WA1) " //system("pause"); " |
|
|