Sicily 1920 Divide The Stones
来源:互联网 发布:mt4顾比均线指标源码 编辑:程序博客网 时间:2024/06/06 11:44
每次最少分出一个,则最后每个堆的 石头数量都是1, 共有sum(a[i])堆。而分出这些石头共需要sum(a[i] - 1)次操作。对这个操作数进行奇偶判断,若为奇数则Alice胜,否则Bob必胜。
#include <iostream>#include <cstring>#include <cstdio>#include <cstdlib>using namespace std;int main(){int t, n;scanf("%d", &t);while (t--){int sum = 0, temp;scanf("%d", &n);for (int i = 0; i < n; i++){scanf("%d", &temp);sum += (temp - 1);}if (sum & 1)printf("Alice\n");elseprintf("Bob\n");}}
0 0
- Sicily 1920 Divide The Stones
- Sicily 1920. Divide The Stones
- 1920. Divide The Stones
- Quantity Of The Stones
- Stones on the Table
- Stones on the Table
- A. Stones on the Table
- hdu 4573 Throw the Stones
- poj 3400 Dropping the stones
- coderforces Stones on the Table
- Chef -- Divide the Tangerine
- Divide the Sequence
- Divide the Sequence
- uva10256 The Great Divide
- Divide the Sequence
- Stones
- Stones
- Stones
- JavaString、StringBuilder、StringBuffer总结
- DB2使用经验积累
- Oracle未启用Partitioning功能解决
- 使用Delphi实现JNI - 实例
- 如何查看python selenium的api
- Sicily 1920 Divide The Stones
- 抽象类与接口的区别
- hdu 5242 树链剖分找权值最大的前k条链
- __stdcall,__cdecl,_cdecl,_stdcall,。__fastcall,_fastcall 区别简介
- 机器学习实战
- 人脸表情识别文献阅读
- poj 3276
- 轮询算法设计及其代码框架
- struts2标签中<s:textfield>中label不显示