ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1407. One-two, One-two

Intresting thing
Posted by Berbinschi Tudor 13 Apr 2011 13:45
#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