File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22import java .io .IOException ;
33import 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+
521public class PrimeGame {
622
723 private static final int NUMBER = 1000000 ;
You can’t perform that action at this time.
0 commit comments