题目链接:bzoj 2463: [中山市选2009]谁能赢呢?
表示YY了0、1、2、3果断就写了。。。
AC
代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#define PI acos(-1.0)
#define CLR(a, b) memset(a, (b), sizeof(a))
#define fi first
#define se second
#define ll o<<1
#define rr o<<1|1
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 1e6+1;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
void getmax(int &a, int b) {a = max(a, b); }
void getmin(int &a, int b) {a = min(a, b); }
void add(LL &x, LL y) { x += y; x %= MOD; }
int main()
{
int n;
while(scanf("%d", &n), n)
{
if(n % 2 == 0)
printf("Alice\n");
else
printf("Bob\n");
}
return 0;
}
本文介绍了一个简单的算法题目,通过判断输入数字的奇偶性来决定游戏的胜者。代码使用C++编写,实现了快速读取输入并输出结果的功能。
1213

被折叠的 条评论
为什么被折叠?



