hdu-4023-博弈(模拟)
Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 1238 Accepted Submission(s): 432

The playground cannot be transformed in any ways, including reflection and rotation.
Given the number of each type of tiles, you are asked to determine who will win the game if Alice plays first and both players are playing optimal.
For each test case, there are only one line contains 15 integers denoting the number of Tetris tiles of the above 15 types. All the numbers are no greater than 100.
5 4 0 0 0 0 0 0 0 0 0 0 0 0 0
5 5 0 0 0 0 0 0 0 0 0 0 0 0 0
100 100 0 0 0 0 0 0 0 0 0 2 1 0 0
Case #2: Bob
Case #3: Alice
#include<bits/stdc++.h>
using namespace std;
int num[];
int main(){
int t,i,j,k,n,m;
cin>>t;
for(int cas=;cas<=t;++cas){
int tot1=,tot2=;
bool op=,ok=;
for(i=;i<;++i) cin>>num[i];
tot1+=num[]*,num[]=;
tot2+=num[]*,num[]=;
while(ok){
if(op==){
if(num[]){
num[]--;
tot1++;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
tot1++;
}
else if(num[]){
num[]--;
tot1++;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
tot2++;
}
else if(num[]){
num[]--;
tot2++;
}
else if(tot1){
tot1--;
}
else{
break;
}
op=;
}
else{
if(num[]){
num[]--;
tot2++;
}
else if(num[]){
num[]--;
tot2++;
}
else if(num[]){
num[]--;
tot2++;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--;
}
else if(num[]){
num[]--; }
else if(num[]){
num[]--;
} else if(num[]){
num[]--;
tot1++;
}
else if(num[]){
num[]--;
tot1++;
}
else if(tot2){
tot2--;
}
else{
break;
}
op=;
}
}
printf("Case #%d: ",cas);
if(op) tot2--;
tot1>tot2?puts("Alice"):puts("Bob");
}
return ;
}
hdu-4023-博弈(模拟)的更多相关文章
- HDU 4023 (博弈 贪心 模拟) Game
如果硬要说这算是博弈题目的话,那这个博弈是不公平博弈(partizan games),因为双方面对同一个局面做出来的决策是不一样的. 我们平时做的博弈都是公平博弈(impartial games),所 ...
- S-Nim HDU 1536 博弈 sg函数
S-Nim HDU 1536 博弈 sg函数 题意 首先输入K,表示一个集合的大小,之后输入集合,表示对于这对石子只能去这个集合中的元素的个数,之后输入 一个m表示接下来对于这个集合要进行m次询问,之 ...
- hdu 4023 2011上海赛区网络赛C 贪心+模拟
以为是贪心,结果不是,2333 贪心最后对自己绝对有利的情况 点我 #include<cstdio> #include<iostream> #include<algori ...
- HDU 4121 Xiangqi 模拟题
Xiangqi Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4121 ...
- hdu 5071 Chat(模拟)
题目链接:hdu 5071 Chat 题目大意:模拟题. .. 注意最后说bye的时候仅仅要和讲过话的妹子说再见. 解题思路:用一个map记录每一个等级的妹子讲过多少话以及是否有这个等级的妹子.数组A ...
- hdu 4740【模拟+深搜】.cpp
题意: 给出老虎的起始点.方向和驴的起始点.方向.. 规定老虎和驴都不会走自己走过的方格,并且当没路走的时候,驴会右转,老虎会左转.. 当转了一次还没路走就会停下来.. 问他们有没有可能在某一格相遇. ...
- HDU 2568[前进]模拟
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2568 关键思想:傻傻地模拟 代码如下: #include<iostream> using ...
- hdu 4964 恶心模拟
http://acm.hdu.edu.cn/showproblem.php?pid=4964 给定语句,按照语法翻译html并输出. 就是恶心的模拟,递归搞就行了 处理id和class时,在一个'&g ...
- HDU 5996 博弈
http://acm.hdu.edu.cn/showproblem.php?pid=5996 博弈论待补. 这题变化了一下,因为注意到奇数层的东西(层数从1开始),对手可以模仿地动,那就相当于没动. ...
- HDU 4994 博弈。
F - 6 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
随机推荐
- Python入门之python可变对象与不可变对象
本文分为如下几个部分 概念 地址问题 作为函数参数 可变参数在类中使用 函数默认参数 类的实现上的差异 概念 可变对象与不可变对象的区别在于对象本身是否可变. python内置的一些类型中 可变对象: ...
- 依赖注入(DI)在PHP中的实现
什么是依赖注入? IOC:英文全称:Inversion of Control,中文名称:控制反转,它还有个名字叫依赖注入(Dependency Injection,简称DI). 当一个类的实例需要另一 ...
- sublime3 离线安装插件
直接去:https://packagecontrol.io/installation搜索插件,插件一般会有个git网址(格式化html的插件可以用这个:https://github.com/victo ...
- noip 2012 提高组 day2 部分题解
这道题有多种解法,我用的是扩展欧几里得算法求到的答案 #include<iostream> #include<fstream> #include<cstdio> u ...
- Log4j将不同Package的日志输出到不同的文件的方法
随着项目规模的越来越大,会不断的引入新的模块,不同的模块都会打印自己的日志,最后就造成日志根本没法查看,比如我自己的项目中,就存在以下这些日志: 接收外界消息的日志.对外发送消息的日志: 后台常驻线程 ...
- 质量管理三个概念:QC、QA和QM,你能分得清吗?
今天这里谈的QC.QA和QM,不是岗位或职位,而是一种概念或质量管理的不同时期所关注的重点. 1.产品 早期的质量管理(工业化雏形期)侧重于对终产品的检测.测试,即QC(品质控制)时代. 这个时期的质 ...
- HDU 2157(矩阵快速幂)题解
How many ways?? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- [TODO]The way to Go(9): 基本类型和运算符
参考: Github: Go Github: The way to Go 基本类型和运算符 表达式是一种特定的类型的值,它可以由其它的值以及运算符组合而成. 每个类型都定义了可以和自己结合的运算符集合 ...
- NS3 一个小问题
可能会在执行./waf 命令的时候遇到这个问题,比如我想编译 /home/wasdns/Documents/NS3/ns-3.17/scratch 目录下的一个文件:newnsthree.cpp 编译 ...
- json字符串在javascript和java代码中的表示方式
最近在使用js写json形式的字符串的时候,当我把json形式的字符串放到函数JSON.parse()的时候,总是报错Uncaught SyntaxError: Unexpected token ' ...