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 ...
随机推荐
- 安装SQL2008时显示:RebootRequiredCheck 检查是否需要挂起计算机重新启动。
解决方法: a.在开始->运行中输入regeditb.删除HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Serverc.删除HKEY_LO ...
- [目前最火的前端开发框架]React组件的应用分析
React组件 一.如何创建React组件 方式一:React.createClass 用 React.createClass 构建组件是 React 最传统.也是兼容最好的方法. const But ...
- Java的各种加密算法
Java的各种加密算法 JAVA中为我们提供了丰富的加密技术,可以基本的分为单向加密和非对称加密 1.单向加密算法 单向加密算法主要用来验证数据传输的过程中,是否被篡改过. BASE64 严格地说,属 ...
- AJAX 与 Python 后台通信
Ajax 简介 Ajax 即“Asynchronous Javascript And XML”(异步 JavaScript 和 XML),是指一种创建交互式网页应用的网页开发技术. Ajax = 异步 ...
- CEF之CefSettings设置日志等级
CefSettings结构体允许定义全局的CEF配置,经常用到的配置项如下: single_process 设置为true时,Browser和Renderer使用一个进程.此项也可以通过命令行参数“s ...
- jQuery 中 $( ) 函数的用法总结
摘要 jQuery对象: 具有jquery框架设置的所有功能的调用者, 就是该框架的对象 $又是什么?: $就是jQuery对象, jQuery对象为window的全局属性, 所以可以直接使用 如何自 ...
- 51NOD 1087 1 10 100 1000
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1087 暴力大法 #include<bits/stdc++.h> ...
- Codeforces Round #542 [Alex Lopashev Thanks-Round] (Div. 1)
A - Toy Train 很显然,一个站有多少个糖,那么就要从这个点运多少次.设第i个点有\(a_i\)个糖,那么就要转\(a_i-1\)圈,然后再走一段.很显然最后一段越小越好. 然后枚举起点后, ...
- NetMagic Simple Overview
参考: NetMagic Startup: How to develop NetMagic rapidly NetMagic Simple Overview NetMagic 是什么? NetMagi ...
- UVa 1152 和为0的4个值(二分查找)
https://vjudge.net/problem/UVA-1152 题意:给定4个n元素集合A,B,C,D,要求分别从中选取一个元素a,b,c,d,使得a+b+c+d=0.问有多少种取法. 思路: ...