A Game for Soft Drinks
Practice
4.3 (3 votes)
Medium
Algorithms
Mathematics
Open
Approved
Game theory
Problem
53% Success 1428 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Ashima's mid term exams are just over. Since, its raining heavily outside, she can't go shopping.
So, she and her best friend Aishwarya have now decided to chill out by eating pizza, chocolates, biscuits, etc.. and playing some indoor games.
The pizza guy has just delivered the pizza, but they forgot to order any soft-drinks with it. And we all know, pizza without soft-drinks is not worth the money. Since, its still raining heavily, none of them wants to go outside to buy soft-drinks from the college canteen.
To solve this problem, they have decided to play a game. The game is as follows:
- They have stacked the biscuits one above another in three piles. The number of biscuits in first pile is N1, in the second pile is N2 and in the third pile is N3.
- Turn by turn, they play as following:
- Pick a biscuit from the top of either pile 1 or pile 2 or pile 3, given that the pile from which you are picking up is not empty.
- Pick a biscuit each from the top of any of two piles the piles, given that both the piles are not empty.
- Pick a biscuit each from the top of all three piles, given that all three are not empty.
- In any move, they have to pick at least one biscuit, using the above rules, the girl who cannot pick any more biscuit loses.
Given the number of biscuits in pile 1, pile 2 and pile 3, and the fact that Ashima plays first, who wins the game and won't have to go outside in the rain.
Note that both the girls really don't wanna go outside in the heavy rain and would play optimally to win this game.
Input:
First line contains Q, the number of queries that follow. Next Q lines, each contains three space-separated integers, N1, N2 and N3, the number of biscuits in pile 1, pile 2 and pile 3 respectively.
Output:
For each query, output who wins, "Ashima" or "Aishwarya" in a separate line.
Constraints:
1 ≤ Q ≤ 10000
0 ≤ N1, N2, N3 ≤ 100
Submissions
Please login to view your submissions
Similar Problems
Points:30
Tags:
Medium
Points:30
7 votes
Tags:
Binary SearchImplementationDynamic ProgrammingAlgorithms4D dynamic programming
Points:30
3 votes
Tags:
AlgorithmsBitmaskDynamic ProgrammingDigitDP4D dynamic programming
Editorial