2793 Instructor's Game

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.