2793 Instructor's game
time limit: 1 sspace limit: KBtitle level: Diamonds Diamond SolvingView Run ResultsTitle Description
Description
There were n students who had just finished their meal and prepared for the canteen.
The National Defense School has a rule: you must leave 2 people in a row or 3 people.
Two instructors A, b take turns to fetch 2 or 3 people, who will win the game first. (a first fetch)
If two people use the best strategy, who will win?
Enter a description
Input Description
N
Output description
Output Description
A win output 1;
B win output-1;
Draw output 0;
If the number is negative, then the instructor NC, output 120. (120 off)
Sample input
Sample Input
7
Sample output
Sample Output
1
Data range and Tips
Data Size & Hint
n<=10000.
Category labels
Tags Click here to expandGame Depth First search recursive search number theory
The brain.
AC Code:
#include <cstdio>#include<iostream>using namespacestd;Long LongN;intMain () {CIN>>N; if(n%5==0) puts ("-1"); Else if(n%5==2|| n%5==3) puts ("1"); Else if(n<0) puts (" -"); ElsePuts"0"); return 0;}
2793 Instructor's Game