#include<bits/stdc++.h>
using namespace std;
int k;
int sg[1000][1000];
int calc(int n, int k){
if(n <= k) return sg[n][k] = 1;
set<int> S;
for(int i = 2; i + k - 1 < n; i++){
int SG = sg[i - 1][k] ^ sg[n - (i + k - 1)][k];
S.insert(SG);
}
// for(int i = 1; i <= k; i++){操作一只有在怪物连续且数量小于等于k才能使用
// int SG = sg[n - i][k];
// S.insert(SG);
// }
int res = 0;
while(S.count(res)) res++;
return sg[n][k] = res;
}
void solve(){
int k, n;
cin >> k >> n;
if(n == 0){
cout << "Bob\n";
return;
}
if(k == 1 && n % 2 == 0){
cout << "Bob\n";
return;
}
if((n - k - 1) % (4 * k + 2) == 0) cout << "Bob\n";
else cout << "Alice\n";
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
// int T;
// cin >> T;
// while(T--){
// solve();
// }
for(int i = 1; i <= 50; i++){
cout << i << ':';
if(i < 10) cout << ' ';
for(int j = 1; j <= 50; j++){
calc(i, j);
cout << (sg[i][j] == 0? 0 : 1) << ' ';
}
cout << '\n';
}
return 0;
}
05-02
813
07-22
490
02-09
261
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交