HDU-4930 Fighting the Landlords 多校训练赛斗地主
仅仅须要推断一个回合就能够了,枚举推断能够一次出全然部牌或者大过对面的牌的可能,注意的是4张同样的牌带两张牌的话是能够被炸弹炸的。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
using namespace std;
struct node
{
int k,mk;
int two,mt;
int three,mth;
int four,mf;
}a[3];
int cnt1[20];
int cnt2[20];
int main()
{
char s1[20];
char s2[20];
int t;
scanf("%d",&t);
while(t--)
{
memset(cnt1,0,sizeof(cnt1));
memset(cnt2,0,sizeof(cnt2));
a[1].k=0;a[1].mk=0;
a[1].two=0;a[1].mt=0;
a[1].three=0;a[1].mth=0;
a[1].four=0;a[1].mf=0;
a[2].k=0;a[2].mk=0;
a[2].two=0;a[2].mt=0;
a[2].three=0;a[2].mth=0;
a[2].four=0;a[2].mf=0;
scanf("%s",s1);
scanf("%s",s2);
int l1,l2;
l1=strlen(s1);
l2=strlen(s2);
for(int i=0;s1[i]!='\0';i++)
{
if(s1[i]>='3'&&s1[i]<='9')
{
cnt1[s1[i]-'2']++;
}
if(s1[i]=='A')
{
cnt1[12]++;
}
if(s1[i]=='2')
{
cnt1[13]++;
}
if(s1[i]=='T')
{
cnt1[8]++;
}
if(s1[i]=='J')
{
cnt1[9]++;
}
if(s1[i]=='Q')
{
cnt1[10]++;
}
if(s1[i]=='K')
{
cnt1[11]++;
}
if(s1[i]=='X')
{
cnt1[14]++;
}
if(s1[i]=='Y')
{
cnt1[15]++;
}
}
for(int i=0;s2[i]!='\0';i++)
{
if(s2[i]>='3'&&s2[i]<='9')
{
cnt2[s2[i]-'2']++;
}
if(s2[i]=='2')
{
cnt2[13]++;
}
if(s2[i]=='A')
{
cnt2[12]++;
}
if(s2[i]=='T')
{
cnt2[8]++;
}
if(s2[i]=='J')
{
cnt2[9]++;
}
if(s2[i]=='Q')
{
cnt2[10]++;
}
if(s2[i]=='K')
{
cnt2[11]++;
}
if(s2[i]=='X')
{
cnt2[14]++;
}
if(s2[i]=='Y')
{
cnt2[15]++;
}
}
for(int i=0;i<16;i++)
{
if(cnt1[i])
{
if(cnt1[i]==1)
{
a[1].k++;
}
a[1].mk=max(a[1].mk,i);
}
if(cnt1[i]==2)
{
a[1].two++;
a[1].mt=max(a[1].mt,i);
}
if(cnt1[i]==3)
{
a[1].three++;
a[1].mth=max(a[1].mth,i);
}
if(cnt1[i]==4)
{
a[1].four++;
a[1].mf=max(a[1].mf,i);
}
}
for(int i=0;i<16;i++)
{
if(cnt2[i])
{
if(cnt2[i]==1)
{
a[2].k++;
}
a[2].mk=max(a[2].mk,i);
}
if(cnt2[i]==2)
{
a[2].two++;
a[2].mt=max(a[2].mt,i);
}
if(cnt2[i]==3)
{
a[2].three++;
a[2].mth=max(a[2].mth,i);
}
if(cnt2[i]==4)
{
a[2].four++;
a[2].mf=max(a[2].mf,i);
}
}
if(cnt1[14]&&cnt1[15])
{
//cout<<"1"<<endl;
cout<<"Yes"<<endl;
continue;
}
if((l1==1)||(l1==2&&a[1].two==1)||(l1==3&&a[1].three==1)||(l1==4&&a[1].four==1)||(l1==4&&a[1].three==1&&a[1].k==1))
{
//cout<<"4"<<endl;
cout<<"Yes"<<endl;
continue;
}
if((l1==5&&a[1].two==1&&a[1].three==1)||(l1==6&&a[1].four==1))
{
//cout<<"5"<<endl;
cout<<"Yes"<<endl;
continue;
}
if(cnt2[14]&&cnt2[15])
{
//cout<<"2"<<endl;
cout<<"No"<<endl;
continue;
}
if(a[1].mk>=a[2].mk&&a[2].four==0)
{
//cout<<"3"<<endl;
cout<<"Yes"<<endl;
continue;
}
if(a[1].two&&a[1].mt>=a[2].mt&&a[1].mt>=a[2].mth&&a[2].four==0)
{
//cout<<"6"<<endl;
cout<<"Yes"<<endl;
continue;
}
if(a[1].three&&(a[1].mth>=a[2].mth||(l1>=4&&l2==3)||(l1>=5&&(a[1].two!=0||a[1].three>1)&&a[2].two==0&&a[2].three==1))&&a[2].four==0)
{
//cout<<"7"<<endl;
cout<<"Yes"<<endl;
continue;
}
if((a[1].four&&a[1].mf>a[2].mf))
{
//cout<<"8"<<endl;
cout<<"Yes"<<endl;
continue;
}
cout<<"No"<<endl;
}
return 0;
}
HDU-4930 Fighting the Landlords 多校训练赛斗地主的更多相关文章
- HDU 4930 Fighting the Landlords(暴力枚举+模拟)
HDU 4930 Fighting the Landlords 题目链接 题意:就是题中那几种牌型.假设先手能一步走完.或者一步让后手无法管上,就赢 思路:先枚举出两个人全部可能的牌型的最大值.然后再 ...
- HDU 4930 Fighting the Landlords(扯淡模拟题)
Fighting the Landlords 大意: 斗地主... . 分别给出两把手牌,肯定都合法.每张牌大小顺序是Y (i.e. colored Joker) > X (i.e. Black ...
- 2014多校第六场 1010 || HDU 4930 Fighting the Landlords (模拟)
题目链接 题意 : 玩斗地主,出一把,只要你这一把对方要不了或者你出这一把之后手里没牌了就算你赢. 思路 : 一开始看了第一段以为要出很多次,实际上只问了第一次你能不能赢或者能不能把牌出尽. #inc ...
- HDU 4930 Fighting the Landlords(模拟)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 解题报告:斗地主,加了一个四张可以带两张不一样的牌,也可以带一对,判断打出一手牌之后,如果对手没 ...
- HDU 4930 Fighting the Landlords --多Trick,较复杂模拟
题意:两个人A和B在打牌,只有题目给出的几种牌能出若A第一次出牌B压不住或者A一次就把牌出完了,那么A赢,输出Yes,否则若A牌没出完而且被B压住了,那么A输,输出No. 解法:知道规则,看清题目,搞 ...
- hdu 4930 Fighting the Landlords--2014 Multi-University Training Contest 6
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 Fighting the Landlords Time Limit: 2000/1000 MS ...
- HDU6578 2019HDU多校训练赛第一场 1001 (dp)
HDU6578 2019HDU多校训练赛第一场 1001 (dp) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6578 题意: 你有n个空需要去填,有 ...
- HDU6579 2019HDU多校训练赛第一场1002 (线性基)
HDU6579 2019HDU多校训练赛第一场1002 (线性基) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6579 题意: 两种操作 1.在序列末 ...
- HDU 4941 Magical Forest(map映射+二分查找)杭电多校训练赛第七场1007
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4941 解题报告:给你一个n*m的矩阵,矩阵的一些方格中有水果,每个水果有一个能量值,现在有三种操作,第 ...
随机推荐
- css3制作扇形菜单
工作中网页中有一个扇形的导航菜单,以前没有接触过,参考了http://www.w3cplus.com/css3/building-a-circular-navigation-with-css-tran ...
- Codeforces 903F Clear the Matrix
题目大意 考虑一个 $4$ 行 $n$ ($4\le n\le 1000$)列的矩阵 $f$,$f$ 中的元素为 * 或 . . 对 $f$ 进行若干次如下变换: 将一个 $k\times k$($1 ...
- python 面向对象与类的基本知识
一 什么是面向对象,面向对象与类的关系. 面向对象的程序设计是用来解决扩展性. 面向过程:根据业务逻辑从上到下写垒代码 函数式:将某功能代码封装到函数中,日后便无需重复编写,仅调用函数即可 面向对象 ...
- 代码动态改变 NGUI UILabel 的字体
有一次因为 ttf 分成简体和繁体两个..所以就需要动态改变NGUI 中 UILabel 的字体,但是不知道 UILabel 保存字体的字段是哪个 网上搜到..在这里记录一下 using UnityE ...
- 开发使用mysql的一些必备知识点整理(三)高级
简介 实体与实体之间有3种对应关系,这些关系也需要存储下来 在开发中需要对存储的数据进行一些处理,用到内置的一些函数 视图用于完成查询语句的封装 事务可以保证复杂的增删改操作有效 关系 创建成绩表sc ...
- 一个页面多个ng-app注意事项
1.一个页面会自动加载第一个ng-app 2.如果想启动其它ng-app,需要通过下列代码的红色部分来启动,此时一共启动了2个ng-app 3.特别注意:代码红色部分一定要放在最后,比如,不能放在蓝色 ...
- js-classList修改class属性
classList定义与用法 1)classList属性返回元素的类名,作为DOMTokenList对象 2)该属性用于在元素中添加,移除及切换css类 3)classList属性是只读的,但可以用a ...
- HDU 5890 Eighty seven(DP+bitset优化)
题目链接 Eighty seven 背包(用bitset预处理)然后对于每个询问O(1)回答即可. 预处理的时候背包. #include <bits/stdc++.h> using nam ...
- bzoj 1835/luogu P2605 : [ZJOI2010]base 基站选址
题目描述 有N个村庄坐落在一条直线上,第i(i>1)个村庄距离第1个村庄的距离为Di.需要在这些村庄中建立不超过K个通讯基站,在第i个村庄建立基站的费用为Ci.如果在距离第i个村庄不超过Si的范 ...
- bzoj 1552: [Cerc2007]robotic sort
1552: [Cerc2007]robotic sort Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 1198 Solved: 457[Submit] ...