Picking coins
Practice
3.8 (111 votes)
Mathematics
Easy
Mathematics
Mathamatics
Problem
92% Success 31934 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Alice and Bob are playing a game of picking coins. They are given a large pile of \(N\) coins and an integer \(k\). In the \(i^{th}\) move of any player, \(k^i\) coins are picked from the pile. A player who is not able to make the move during his turn loses. You are required to predict the winner of the game.

Note: In every turn, Alice plays first followed by Bob.

Input format

  • First line: \(T\) that represents the total number of test cases
  • Each line of the test case: Two space-separated integers \(N\) and \(k\)  

Output format

For each test case, you are required to print the name of the winner of the game. You have to print either Alice or Bob depending upon who is the winner of the game.

Constraints
\(1 \le T \le 100\)
\(1 \le N , k \le 10^{18}\)             

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
Easy
Points:20
5 votes
Tags:
MathematicsOpenEasyMathematicsMathamatics
Points:20
1 votes
Tags:
MathematicsApprovedEasyNumber TheoryMathematicsMathamatics