Determine the winner
Practice
3.6 (36 votes)
Easy
Logic Based
Game theory
Nim
Mathematics
Problem
18% Success 11559 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Arpa and Dishant are playing a game with a pile of \(N\) cards. Both the players taketheir turns alternately starting from Arpa. In each turn, a player can remove at least \(1\) and at most \(K\) cards from the pile. If a player cannot make the next move, then the player loses the game. If both the players play optimally, your task is to determine the winner. You need to determine the winners for \(T\) independent games.
Input format
- First line: \(T\) denoting the number of test cases \((1 \le T \le 10^5)\)
- First and only line of each test case: A single line containing two space-separated integers \(N\) and \(K\) \((1 \le K \le N \le 10^{18})\)
Output format
For each test case, considering that both the players play optimally, print "Arpa" (without quotes) if he wins the game else print "Dishant" (without quotes) in a new line.
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
Easy
Points:20
1 votes
Tags:
EasyMathGame Theory
Editorial