2793 教官的游戏

2793 教官的游戏

 

 时间限制: 1 s
 空间限制: 2000 KB
 题目等级 : 钻石 Diamond
 
 
题目描述 Description

有N个学生刚吃完饭,准备出食堂。

国防学校有个规矩:必须2人一排或3人一列离开。

两个教官A,B轮流取2或3人,谁先取完谁就赢得游戏。(A先取)

若两人都用最优策略,谁会赢?

输入描述 Input Description

N

输出描述 Output Description

A赢输出1;

B赢输出-1;

平局输出0;

若人数为负,则教官NC了,输出120.(该打120了)

样例输入 Sample Input

7

样例输出 Sample Output

1

数据范围及提示 Data Size & Hint

N<=10000.

分类标签 Tags 点此展开 

 
 
脑子啊
 
AC代码:
#include<cstdio>
#include<iostream>
using namespace std;
long long n;
int main(){
    cin>>n;
    if(n%5==0) puts("-1");
    else if(n%5==2||n%5==3) puts("1");
    else if(n<0) puts("120");
    else puts("0");
    return 0;
}

 

posted @ 2016-07-05 09:46  神犇(shenben)  阅读(200)  评论(0编辑  收藏  举报