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 1639. Chocolate 2

why is my code wrong??????????
Posted by milad 8 Jul 2011 21:11
#include <iostream>

using namespace std;

int main()
{
int a,m,n;
cin>>n>>m;
a=(n*m)&2;
if(a!=0)
cout<<"[second]=:]"<<endl;
else if(a==0)
cout<<"[:=[first]"<<endl;

    return 0;
}

Edited by author 08.07.2011 21:11

Edited by author 08.07.2011 21:11
Re: why is my code wrong??????????
Posted by Leonid (SLenik) Andrievskiy 31 Jul 2011 00:50
The error is in line:
> a=(n*m)&2;

Replace it with this:
> a=(n*m)%2;
Or this:
> a=(n*m)&1;