http://acm.hdu.edu.cn/showproblem.php?pid=1847
从1开始枚举情况,找规律。1先手胜2先手胜3先手败4先手胜5先手胜...
n只要能转移到先手败,就可以实现先手胜,否则n情况下就是先手败。发现规律时%3
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<cstdlib> 6 #include<cmath> 7 #define lson l, m, rt<<1 8 #define rson m+1, r, rt<<1|1 9 #define IO ios::sync_with_stdio(false);cin.tie(0); 10 #define INF 1e9 11 typedef long long ll; 12 using namespace std; 13 int t, n, m; 14 int main() 15 { 16 IO; 17 while(cin >> n){ 18 if(n%3==0) cout << "Cici" << endl; 19 else cout << "Kiki" << endl; 20 } 21 return 0; 22 }
原文地址:https://www.cnblogs.com/Surprisezang/p/8886244.html
时间: 2024-11-05 23:18:44