题目链接:http://codeforces.com/problemset/problem/1451/D
题目大意:两个人轮流向右或向上走,每次只能走k距离,走后的坐标(x,y)必须满足 x*x+y*y<=d*d ,否则不能走,不能走的人输。Ashish先走,两个人都按照最优策略走,让你判断谁输谁赢。
思路:对称博弈的变形。因为两个人都按照最优策略进行移动,所以如果我每次都走到(nk,nk)的点上,是走了2n步,如果还能继续走那就是A赢,如果在走一步就出去了,那即是U赢比赛 。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <utility>
#define cla(a, sum) memset(a, sum, sizeof(a))
#define rap(i, m, n) for(int i=m; i<=n; i++)
#define rep(i, m, n) for(int i=m; i>=n; i--)
#define bug printf("???\n")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int Inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int mod=998244353;
const int maxn = 1e6+5;
const int N=1e5;
template <typename T> void read(T &x){
x = 0; int f = 1; char ch = getchar();
while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
x *= f;
}
ll t,n,k;
int main()
{
//ios::sync_with_stdio(false),cin.tie(0);
cin>>t;
while(t--){
cin>>n>>k;
ll sum=(n/k)*k;
while(sum*sum+sum*sum>=n*n){//(x,y)x==y 的最大点
sum-=k;
}
ll sum2=sum;
ll step=-1;
while(sum*sum+sum2*sum2<=n*n){
step++;
sum2+=k;
}
if(step%2==0){
cout<<"Utkarsh"<<endl;
}
else{
cout<<"Ashish"<<endl;
}
}
return 0;
}