Problem Statement
Explanation: This might seem like a math problem. But it's not. There's a pattern in here. Firstly, figure out when output has no number. If you can figure it out then try to recognise the relation of the output with co-ordinates (x, y)
Explanation: This might seem like a math problem. But it's not. There's a pattern in here. Firstly, figure out when output has no number. If you can figure it out then try to recognise the relation of the output with co-ordinates (x, y)
Solution is given below:
#include<stdio.h>
int main()
{
int t,x,y;
scanf("%d",&t);
while(t--&&t>=0)
{
scanf("%d%d",&x,&y);
if(y==x||y==x-2)
{
if(x%2==0) printf("%d\n",x+y);
else printf("%d\n",x+y-1);
}
else
{
printf("No Number\n");
}
}
}
Comments
Post a Comment