# 【Codeforces 1451 D】Circle Game，博弈论，游戏题

#### problem

D. Circle Game
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
Utkarsh is forced to play yet another one of Ashish’s games. The game progresses turn by turn and as usual, Ashish moves first.

Consider the 2D plane. There is a token which is initially at (0,0). In one move a player must increase either the x coordinate or the y coordinate of the token by exactly k. In doing so, the player must ensure that the token stays within a (Euclidean) distance d from (0,0).

In other words, if after a move the coordinates of the token are (p,q), then p2+q2≤d2 must hold.

The game ends when a player is unable to make a move. It can be shown that the game will end in a finite number of moves. If both players play optimally, determine who will win.

Input
The first line contains a single integer t (1≤t≤100) — the number of test cases.

The only line of each test case contains two space separated integers d (1≤d≤105) and k (1≤k≤d).

Output
For each test case, if Ashish wins the game, print “Ashish”, otherwise print “Utkarsh” (without the quotes).

Example
inputCopy
5
2 1
5 2
10 3
25 4
15441 33
outputCopy
Utkarsh
Ashish
Utkarsh
Utkarsh
Ashish
Note
In the first test case, one possible sequence of moves can be

(0,0)−→−−−Ashish (0,1)−→−−−−Utkarsh (0,2).

Ashish has no moves left, so Utkarsh wins.

D. Circle Game
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
Utkarsh is forced to play yet another one of Ashish’s games. The game progresses turn by turn and as usual, Ashish moves first.

Consider the 2D plane. There is a token which is initially at (0,0). In one move a player must increase either the x coordinate or the y coordinate of the token by exactly k. In doing so, the player must ensure that the token stays within a (Euclidean) distance d from (0,0).

In other words, if after a move the coordinates of the token are (p,q), then p2+q2≤d2 must hold.

The game ends when a player is unable to make a move. It can be shown that the game will end in a finite number of moves. If both players play optimally, determine who will win.

Input
The first line contains a single integer t (1≤t≤100) — the number of test cases.

The only line of each test case contains two space separated integers d (1≤d≤105) and k (1≤k≤d).

Output
For each test case, if Ashish wins the game, print “Ashish”, otherwise print “Utkarsh” (without the quotes).

Example
inputCopy
5
2 1
5 2
10 3
25 4
15441 33
outputCopy
Utkarsh
Ashish
Utkarsh
Utkarsh
Ashish
Note
In the first test case, one possible sequence of moves can be

(0,0)−→−−−Ashish (0,1)−→−−−−Utkarsh (0,2).

Ashish has no moves left, so Utkarsh wins.

#### solution

/*

+ 令牌初始在(0,0)，每次可令其x或y加上k
+ Ashish先手，若距离原点超过d则输，求谁赢得比赛

+ 首先算出在不走出圆圈的情况下，最多能走几步
+ 如果是偶数，则下次是A，A必输。
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e6+10;
const int mod = 1e9+7;
int main(){
int T;  cin>>T;
while(T--){
LL d, k;  cin>>d>>k;
LL mx = 0;
for(int i = 0; i <= d; i += k){
LL x = i, y = sqrt(d*d-x*x);
mx = max(mx,x/k+y/k);
}
if(mx%2==0)cout<<"Utkarsh\n";
else cout<<"Ashish\n";
}
return 0;
}



05-12 459
08-09 271
08-23 1957
09-26 1425
03-03 43
08-09 1万+
07-22 2150