POJ 1704 Georgia and Bob G++
来源:互联网 发布:js字符串include 编辑:程序博客网 时间:2024/06/06 02:17
#include <iostream>#include <algorithm>using namespace std;int main(){int n;cin>>n;int jg[n];for(int i=0;i<n;i++){int NUM;cin>>NUM;int a[NUM];for(int j=0;j<NUM;j++){cin>>a[j];}sort(a,a+NUM);//排序 /*for(int j=0;j<NUM;j++){cout<<a[j]<<" ";}cout<<endl;*/jg[i]=0; if(NUM%2==1)//奇数 {jg[i]=a[0]-1;//没减1 for(int j=1;j<NUM;j++){jg[i]^=a[j+1]-a[j]-1;//cout<<jg[i]<<endl;j++;}}else if(NUM%2==0)//偶数 {for(int j=0;j<NUM;j++){jg[i]^=a[j+1]-a[j]-1;//cout<<jg[i]<<endl;j++;}}}for(int i=0;i<n;i++){//cout<<jg[i]<<endl;if(jg[i]==0)//平衡的 玩家2赢 {cout<<"Bob will win"<<endl; }else{cout<<"Georgia will win"<<endl;} } }
如图,n个棋子,给出每个棋子的位置,Georgia和Bob轮流选择一个棋子向左移动,无法移动的一方失败。
阅读全文
0 0
- POJ 1704 Georgia and Bob G++
- POJ 1704 Georgia and Bob
- POJ 1704 Georgia and Bob
- POJ 1704 Georgia and Bob
- POJ 1704 Georgia and Bob
- POJ-1704-Georgia and Bob
- POJ - 1704 Georgia and Bob
- POJ 1704 Georgia and Bob
- POJ 1704 Georgia and Bob
- POJ 1704:Georgia and Bob
- 【poj 1704】Georgia and Bob
- poj 1704 Georgia and Bob
- POJ 1704 Georgia and Bob
- Georgia and Bob POJ 1704
- Georgia and Bob POJ
- poj 1704 Georgia and Bob(博弈)
- POJ 1704(Georgia and Bob-Nim博弈)
- poj 1704 Georgia and Bob 博弈
- ArcGIS Server JavaScript API 各命名空间的含义
- jQuery 效果
- java使用SXSSFWorkbook生成具有图片与文字的Excel表格
- arraycopy方法(实现两个数组之间固定位置的相互转换)
- Error running app: This version of Android Studio is incompatible with the Gradle Plugin used.
- POJ 1704 Georgia and Bob G++
- 23种设计模式(20):外观模式(1)
- MySQL utf8mb4 字符集,用于存储emoji表情
- ArcGIS API for Javascript Graphic心得
- 返回某个文件夹下所有的文件
- HDU 1312 Red and Black (DFS)
- 期货常识(华人投教)
- MFC全局函数开局——AfxGetApp解剖
- crontab 每分钟、每小时、每天、每周、每月、每年执行