|
|
back to boardIntresting thing #include <iostream> #include <cmath> using namespace std; int i,x[1000],k; int n,nr; int main() { cin >>n; for (i=1;i<=n;i++) { if (i%3==2) nr=nr*10+1; if (i%3==0) nr=nr*10+1; if (i%3==1) nr=nr*10+2; } i=n; while (i>=0) { x[i]=nr%10; nr=nr/10; i--; } nr=0; for (i=n;i>0;i--) nr=nr*10+x[i]; k=1; for (i=1;i<=n;i++) k=k*2; if (nr%k==0) cout <<nr; else cout <<"No solution"; return 0; } With this source code I get WA on test 4. Pretty strange.HuH? Edited by author 13.04.2011 13:45 Edited by author 13.04.2011 13:45 |
|
|