Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Yet Another Number Game

$
0
0

In our question said that "both play optimally". and in the question said that "a player can subtract from N any proper divisor (not equal to N)". I use this method: n=49 d(49)={1,7,49} 1)Alice: n=49-1=48

d(48)={1,2,3,4,6,8,16,24,48} 2)Bob:n=48-24=24

d(24)={1,2,3,4,6,12,24} 3)Alice: n=24-12=12

d(12)={1,2,3,4,6,12} 4)Bob: n=12-6=6

d(6)={1,2,3,6} 5)Alice: n=6-3=3

d(3)={1,3} 6)Bob: n=3-1=2

d(2)={1,2} 7)Alice: n=2-1=1 and Alice win.

but there is another way:

n=49 d(49)={1,7,49} 1)Alice: n=49-7=42

d(42)={1,2,3,6,7,14,21,42} 2)Bob:n=42-21=21

d(21)={1,3,7,21} 3)Alice: n=21-7=14

d(14)={1,2,7,14} 4)Bob: n=14-7=7

d(7)={1,7} 5)Alice: n=7-1=6

d(6)={1,2,3,6} 6)Bob: n=6-3=3

d(3)={1,3} 7)Alice: n=3-1=2

d(2)={1,2} 8)Bob: n=2-1=1 and Bob win.

which is optimally?first or second ? and can you says that which test my program give wrong answer?


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>