标签:+= ++i tps etc 操作 png getch cst lin
题目大意:给你\(N\)堆\(Stone\),两个人玩游戏. 每次任选一堆,首先拿掉至少一个石头,然后移动任意个石子到任意堆中. 谁不能移动了,谁就输了
#include <cstdio>
#include <algorithm>
int a[100005];
int read() {
int x = 0; char c = getchar();
while (c < '0' || c > '9') c = getchar();
while (c >= '0' && c <= '9') {
x = (x << 3) + (x << 1) + (c ^ 48);
c = getchar();
}
return x;
}
int main() {
int n = read();
for (int i = 1; i <= n; ++i) a[i] = read();
std::sort(a + 1, a + n + 1);
for (int i = 1; i <= n; i += 2)
if(a[i] != a[i+1]){
puts("first player");
return 0;
}
puts("second player");
return 0;
}
标签:+= ++i tps etc 操作 png getch cst lin
原文地址:https://www.cnblogs.com/LMSH7/p/9573410.html