AASF-IIITM / spojprobs

Solutions to spoj problems
1 stars 37 forks source link

NGM - A Game with Numbers #37

Closed saket13 closed 6 years ago

saket13 commented 6 years ago

Nikifor and Trofim play the following game: they write some positive integer smaller than 2,000,000,000 and take turns one after another. Nikifor is the first to make a move. The turn is made by the following rule: from the written integer any non-zero digit is subtracted, and the new integer replaces the old one on the desk. For example for integer 40534, the next move can be: 40530, 40531 or 40529. The winner is the player who writes zero on the desk.

Write a program to decide who will win if both players do their best.

haritha1313 commented 6 years ago

@saket13 Thanks for the PR. Keep contributing!