DTMA2015 NGAME - EDITORIAL

PROBLEM LINK:

Author: Vaibhav Singhal (v_a_b_s), Mohan Ghai (mind_card), Shivam Duggal (shivamd)

Tester: Arpit Aggarwal ( arpitdec5 )

Editorialist: Arpit Aggarwal ( arpitdec5 )

DIFFICULTY:

SIMPLE

PREREQUISITES:

No Pre-requisite

PROBLEM:

The problem consists of two players playing a game. Initially they are given a number n and at each step they can reduce it by 1 2 or 3 . Find the winner .

QUICK EXPLANATION:

The problem is really simple . It asks for the winner which is " first " if n is not a multiple of 4 otherwise its " second ".

EXPLANATION:

Initially we are given an integer n and first player moves first and the other second. Now we can easily observe that if n is a multiple of 4 then second player always win no matter what the first player moves as they are allowed to subtract 1 2 or 3. Otherwise its first player who wins .

AUTHOR’S AND TESTER’S SOLUTIONS:

Tester’s solution: http://ideone.com/HwbUer

//