#include<bits/stdc++.h>
using namespace std;
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define PI acos(-1.0)
#define MOD 1000000007
#define MX 100010
int arr[5005][5005];
void precal(int x, int y, int val)
{
if(x>=502 && y>=502) return;
arr[x][y]=val;
x++, y++, val++;
arr[x][y]=val;
x++, y--, val++;
arr[x][y]=val;
x++, y++, val++;
arr[x][y]=val;
x--, y++, val++;
precal(x, y, val);
return;
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
int tc, kk=1, n, m, x, y;
string s;
char ch;
precal(0, 0, 0);
cin>>tc;
while(tc--)
{
cin>>x>>y;
if(!x && !y) cout<<0<<"\n";
else if(arr[x][y]) cout<<arr[x][y]<<"\n";
else cout<<"No Number\n";
}
return 0;
}
No comments:
Post a Comment