Skip to content

Commit

Permalink
20240306 lengli's submission for CF1194D (#122)
Browse files Browse the repository at this point in the history
20240306 lengli's submission for CF1194D
  • Loading branch information
gxylengli authored Mar 6, 2024
1 parent 0f2c35a commit fcb0662
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//如果没有k那么显然n%3==0先手必败(参考nim游戏)
//显然当k%3==0时候,才会对局面产生影响
//k%==0将原本的胜负分成了k+1块,k会影响不同块的胜负关系
//则胜负关系将会以k+1为周期循环
//那么将n对k+1取模后,变成了只有1,2的nim游戏

/*
lengli_QAQ
Hope there are no bugs!!!
*/
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl '\n'
#define all(x) x.begin(),x.end()
#define pb push_back

using namespace std;

#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) "lengli"
#endif

const int N=100010;

void solve(){
int n,k;
cin>>n>>k;
if(k%3==0){
n%=(k+1);
}
if(n==k) cout<<"Alice"<<endl;
else{
if(n%3==0) cout<<"Bob"<<endl;
else cout<<"Alice"<<endl;
}
}

signed main(){
fastio;
int T;
cin>>T;
while(T--) solve();

return 0;
}

0 comments on commit fcb0662

Please sign in to comment.