Tom and Jerry Geeksforgeeks Solution

Tom and Jerry GeeksForGeeks Solution In CPP

Once upon a time Tom and Jerry thought of having a race on a circular track. The diameter of the trek was 200 yards.

They both started from same starting point but Tom being confident did not move until he found Jerry has moved 1/8-th of the distance. Now Tom starts to move and meets Jerry on the circular track. Tom finds that at this point in time, he has moved only 1/6th of total distance. Now the fear of losing the race starts to disturb him. He starts wondering how much faster should he move comparatively to win the race. Please help him.

Question by Geeksforgeeks

Solution:-

#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin>>t;
while(t–)
{
unsigned long long int N=0;
cin>>N;
if(N==0)
cout<<1<<endl;
if(N%2==0)
cout<<1<<endl;
else
cout<<0<<endl;
}
return 0;
}

Output:-

Tom and Jerry Geeksforgeeks Solution