Circle Game(博弈论)

链接

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 ) t (1≤t≤100) t(1t100) — the number of test cases.

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

Output

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

Example

input

5
2 1
5 2
10 3
25 4
15441 33

output

Utkarsh
Ashish
Utkarsh
Utkarsh
Ashish

Note

In the first test case, one possible sequence of moves can be

( 0 , 0 ) → A s h i s h ( 0 , 1 ) → U t k a r s h ( 0 , 2 ) (0,0)→Ashish (0,1)→Utkarsh (0,2) (0,0)Ashish(0,1)Utkarsh(0,2).

Ashish has no moves left, so Utkarsh wins.

思路

找到一个 ( x k , x k ) (xk,xk) (xk,xk) 点,使得 ( x k , x k ) (xk,xk) (xk,xk) 在圆内, ( x k + 1 , x k + k ) (xk+1,xk+k) (xk+1,xk+k) 在圆外。

  1. ( x k , x k + k ) (xk,xk+k) (xk,xk+k) 在圆外,那么先手必败。

因为 ( x k , x k + 1 ) (xk,xk+1) (xk,xk+1) 在圆外,所以 ( x k + 1 , x k ) (xk+1,xk) (xk+1,xk) 也在圆外。也即是说, ( x k , x k ) (xk,xk) (xk,xk) 先手必败。那么 ( x k − k , x k ) (xk-k,xk) (xkk,xk) ( x k , x k − k ) (xk,xk-k) (xk,xkk) 先手必胜, ( x k − k , x k − k ) (xk-k,xk-k) (xkk,xkk)先手必败。从而,所有横纵坐标相同的点先手必败。

  1. 否则先手必胜。

首先,可以通过不等式证明:当 ( x k , x k ) (xk,xk) (xk,xk) 在圆内, ( x k + k , x k + k ) (xk+k,xk+k) (xk+k,xk+k) 在圆外时, ( x k + 2 k , x k ) (xk+2k,xk) (xk+2k,xk) ( x k , x k + 2 k ) (xk,xk+2k) (xk,xk+2k) 必在圆外。当 ( x k + k , x k ) (xk+k,xk) (xk+k,xk) 也在圆内时,对于这个点,他向上或向右都超出了圆外,所以 ( x k + k , x k ) (xk+k,xk) (xk+k,xk) 是必败状态。同理, ( x k , x k + k ) (xk,xk+k) (xk,xk+k) 也先手必败,那么 ( x k , x k ) (xk,xk) (xk,xk) 先手必胜。从而,所有横纵坐标相同的点都先手必胜。

#include<bits/stdc++.h>
#define int long long
using namespace std;
int T,d,k;

void solve(){
	cin>>d>>k;
	int x=sqrt(d*d/2);
	x-=x%k;
	if(x*x+(x+k)*(x+k)>d*d) cout<<"Utkarsh\n";
	else cout<<"Ashish\n";
}

signed main(){
	ios::sync_with_stdio(false);
	for(cin>>T;T;T--) solve();
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

m0_51864047

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值