- #include <bits/stdc++.h>
- using namespace std;
- int dp[10005];
- int cal(int n){
- if(n<=2){
- return 0;
- }
- if(dp[n]!= -1){
- return dp[n];
- }
- set<int>s;
- for(int a = 1,b = n-1; a<b; a++, b--){
- s.insert(cal(a)^cal(b));
- }
- int ans = 0;
- while(s.find(ans)!= s.end()) ans++;
- return dp[n] = ans;
- }
- int main()
- {
- int tc;
- cin>>tc;
- memset(dp, -1, sizeof(dp));
- for(int p = 0; p < tc; ++p){
- int n;
- cin>>n;
- int ans = 0;
- for(int i = 0; i <n; i++){
- int a;
- cin>>a;
- ans^= cal(a);
- }
- if(ans) cout<<"Case "<<(p+1)<<": "<<"Alice"<<endl;
- else cout<<"Case "<<(p+1)<<": "<<"Bob"<<endl;
- }
- return 0;
- }
Thursday 27 July 2017
Lightoj 1199 - Partitioning Game
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
Problem link: Problem Analysis: It is actually a basic Bisection problem , as we can see here we can not actually find a formula fo...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
No comments:
Post a Comment