Skip to content

Commit 0281422

Browse files
add question as comment
1 parent 8c60817 commit 0281422

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

CodeChef/PrimeGame.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
import java.io.IOException;
33
import java.io.InputStreamReader;
44

5+
/*
6+
7+
QUESTION:
8+
9+
Chef and Divyam are playing a game with the following rules:
10+
11+
First, an integer X! is written on a board.
12+
Chef and Divyam alternate turns; Chef plays first.
13+
In each move, the current player should choose a positive integer D which is divisible by up to Y distinct primes
14+
and does not exceed the integer currently written on the board. Note that 1 is not a prime.
15+
D is then subtracted from the integer on the board, i.e. if the integer written on the board before this move was A,
16+
it is erased and replaced by A−D.
17+
When one player writes 0 on the board, the game ends and this player wins.
18+
Given X and Y, determine the winner of the game.
19+
*/
20+
521
public class PrimeGame {
622

723
private static final int NUMBER = 1000000;

0 commit comments

Comments
 (0)