仅仅须要推断一个回合就能够了,枚举推断能够一次出全然部牌或者大过对面的牌的可能,注意的是4张同样的牌带两张牌的话是能够被炸弹炸的。

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <cmath>
  5. #include <queue>
  6. #include <algorithm>
  7. #include <cstdlib>
  8. #include <iomanip>
  9. using namespace std;
  10. struct node
  11. {
  12. int k,mk;
  13. int two,mt;
  14. int three,mth;
  15. int four,mf;
  16. }a[3];
  17. int cnt1[20];
  18. int cnt2[20];
  19. int main()
  20. {
  21. char s1[20];
  22. char s2[20];
  23. int t;
  24. scanf("%d",&t);
  25. while(t--)
  26. {
  27. memset(cnt1,0,sizeof(cnt1));
  28. memset(cnt2,0,sizeof(cnt2));
  29. a[1].k=0;a[1].mk=0;
  30. a[1].two=0;a[1].mt=0;
  31. a[1].three=0;a[1].mth=0;
  32. a[1].four=0;a[1].mf=0;
  33. a[2].k=0;a[2].mk=0;
  34. a[2].two=0;a[2].mt=0;
  35. a[2].three=0;a[2].mth=0;
  36. a[2].four=0;a[2].mf=0;
  37. scanf("%s",s1);
  38. scanf("%s",s2);
  39. int l1,l2;
  40. l1=strlen(s1);
  41. l2=strlen(s2);
  42. for(int i=0;s1[i]!='\0';i++)
  43. {
  44. if(s1[i]>='3'&&s1[i]<='9')
  45. {
  46. cnt1[s1[i]-'2']++;
  47. }
  48. if(s1[i]=='A')
  49. {
  50. cnt1[12]++;
  51. }
  52. if(s1[i]=='2')
  53. {
  54. cnt1[13]++;
  55. }
  56. if(s1[i]=='T')
  57. {
  58. cnt1[8]++;
  59. }
  60. if(s1[i]=='J')
  61. {
  62. cnt1[9]++;
  63. }
  64. if(s1[i]=='Q')
  65. {
  66. cnt1[10]++;
  67. }
  68. if(s1[i]=='K')
  69. {
  70. cnt1[11]++;
  71. }
  72. if(s1[i]=='X')
  73. {
  74. cnt1[14]++;
  75. }
  76. if(s1[i]=='Y')
  77. {
  78. cnt1[15]++;
  79. }
  80. }
  81. for(int i=0;s2[i]!='\0';i++)
  82. {
  83. if(s2[i]>='3'&&s2[i]<='9')
  84. {
  85. cnt2[s2[i]-'2']++;
  86. }
  87. if(s2[i]=='2')
  88. {
  89. cnt2[13]++;
  90. }
  91. if(s2[i]=='A')
  92. {
  93. cnt2[12]++;
  94. }
  95. if(s2[i]=='T')
  96. {
  97. cnt2[8]++;
  98. }
  99. if(s2[i]=='J')
  100. {
  101. cnt2[9]++;
  102. }
  103. if(s2[i]=='Q')
  104. {
  105. cnt2[10]++;
  106. }
  107. if(s2[i]=='K')
  108. {
  109. cnt2[11]++;
  110. }
  111. if(s2[i]=='X')
  112. {
  113. cnt2[14]++;
  114. }
  115. if(s2[i]=='Y')
  116. {
  117. cnt2[15]++;
  118. }
  119. }
  120. for(int i=0;i<16;i++)
  121. {
  122. if(cnt1[i])
  123. {
  124. if(cnt1[i]==1)
  125. {
  126. a[1].k++;
  127. }
  128. a[1].mk=max(a[1].mk,i);
  129. }
  130. if(cnt1[i]==2)
  131. {
  132. a[1].two++;
  133. a[1].mt=max(a[1].mt,i);
  134. }
  135. if(cnt1[i]==3)
  136. {
  137. a[1].three++;
  138. a[1].mth=max(a[1].mth,i);
  139. }
  140. if(cnt1[i]==4)
  141. {
  142. a[1].four++;
  143. a[1].mf=max(a[1].mf,i);
  144. }
  145. }
  146. for(int i=0;i<16;i++)
  147. {
  148. if(cnt2[i])
  149. {
  150. if(cnt2[i]==1)
  151. {
  152. a[2].k++;
  153. }
  154. a[2].mk=max(a[2].mk,i);
  155. }
  156. if(cnt2[i]==2)
  157. {
  158. a[2].two++;
  159. a[2].mt=max(a[2].mt,i);
  160. }
  161. if(cnt2[i]==3)
  162. {
  163. a[2].three++;
  164. a[2].mth=max(a[2].mth,i);
  165. }
  166. if(cnt2[i]==4)
  167. {
  168. a[2].four++;
  169. a[2].mf=max(a[2].mf,i);
  170. }
  171. }
  172. if(cnt1[14]&&cnt1[15])
  173. {
  174. //cout<<"1"<<endl;
  175. cout<<"Yes"<<endl;
  176. continue;
  177. }
  178. 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))
  179. {
  180. //cout<<"4"<<endl;
  181. cout<<"Yes"<<endl;
  182. continue;
  183. }
  184. if((l1==5&&a[1].two==1&&a[1].three==1)||(l1==6&&a[1].four==1))
  185. {
  186. //cout<<"5"<<endl;
  187. cout<<"Yes"<<endl;
  188. continue;
  189. }
  190. if(cnt2[14]&&cnt2[15])
  191. {
  192. //cout<<"2"<<endl;
  193. cout<<"No"<<endl;
  194. continue;
  195. }
  196. if(a[1].mk>=a[2].mk&&a[2].four==0)
  197. {
  198. //cout<<"3"<<endl;
  199. cout<<"Yes"<<endl;
  200. continue;
  201. }
  202. if(a[1].two&&a[1].mt>=a[2].mt&&a[1].mt>=a[2].mth&&a[2].four==0)
  203. {
  204. //cout<<"6"<<endl;
  205. cout<<"Yes"<<endl;
  206. continue;
  207. }
  208. 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)
  209. {
  210. //cout<<"7"<<endl;
  211. cout<<"Yes"<<endl;
  212. continue;
  213. }
  214. if((a[1].four&&a[1].mf>a[2].mf))
  215. {
  216. //cout<<"8"<<endl;
  217. cout<<"Yes"<<endl;
  218. continue;
  219. }
  220. cout<<"No"<<endl;
  221. }
  222. return 0;
  223. }

HDU-4930 Fighting the Landlords 多校训练赛斗地主的更多相关文章

  1. HDU 4930 Fighting the Landlords(暴力枚举+模拟)

    HDU 4930 Fighting the Landlords 题目链接 题意:就是题中那几种牌型.假设先手能一步走完.或者一步让后手无法管上,就赢 思路:先枚举出两个人全部可能的牌型的最大值.然后再 ...

  2. HDU 4930 Fighting the Landlords(扯淡模拟题)

    Fighting the Landlords 大意: 斗地主... . 分别给出两把手牌,肯定都合法.每张牌大小顺序是Y (i.e. colored Joker) > X (i.e. Black ...

  3. 2014多校第六场 1010 || HDU 4930 Fighting the Landlords (模拟)

    题目链接 题意 : 玩斗地主,出一把,只要你这一把对方要不了或者你出这一把之后手里没牌了就算你赢. 思路 : 一开始看了第一段以为要出很多次,实际上只问了第一次你能不能赢或者能不能把牌出尽. #inc ...

  4. HDU 4930 Fighting the Landlords(模拟)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 解题报告:斗地主,加了一个四张可以带两张不一样的牌,也可以带一对,判断打出一手牌之后,如果对手没 ...

  5. HDU 4930 Fighting the Landlords --多Trick,较复杂模拟

    题意:两个人A和B在打牌,只有题目给出的几种牌能出若A第一次出牌B压不住或者A一次就把牌出完了,那么A赢,输出Yes,否则若A牌没出完而且被B压住了,那么A输,输出No. 解法:知道规则,看清题目,搞 ...

  6. 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 ...

  7. HDU6578 2019HDU多校训练赛第一场 1001 (dp)

    HDU6578 2019HDU多校训练赛第一场 1001 (dp) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6578 题意: 你有n个空需要去填,有 ...

  8. HDU6579 2019HDU多校训练赛第一场1002 (线性基)

    HDU6579 2019HDU多校训练赛第一场1002 (线性基) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6579 题意: 两种操作 1.在序列末 ...

  9. HDU 4941 Magical Forest(map映射+二分查找)杭电多校训练赛第七场1007

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4941 解题报告:给你一个n*m的矩阵,矩阵的一些方格中有水果,每个水果有一个能量值,现在有三种操作,第 ...

随机推荐

  1. Welcome-to-Swift-22泛型(Generics)

    泛型代码可以确保你写出灵活的,可重用的函数和定义出任何你所确定好的需求的类型.你可以写出避免重复的代码,并且用一种清晰的,抽象的方式表达出来. 泛型是Swift许多强大特征中的其中一个,许多Swift ...

  2. 国外12家值得注意的SD-WAN厂商

    国外12家值得注意的SD-WAN厂商 来源 https://www.sdnlab.com/18611.html 在网络行业,围绕软件定义网络的炒作似乎已经殆尽,但业界普遍对软件定义广域网(SD-WAN ...

  3. 洛谷P3327 [SDOI2015]约数个数和 【莫比乌斯反演】

    题目 设d(x)为x的约数个数,给定N.M,求\(\sum_{i = 1}^{N} \sum_{j = 1}^{M} d(ij)\) 输入格式 输入文件包含多组测试数据.第一行,一个整数T,表示测试数 ...

  4. 对于quartz的控制台不断打印

    控制台不断打印 batch acquisition of 0 triggers 解决方式   : 在log4j.properties的配置文件中加 log4j.logger.org.quartz=IN ...

  5. Microsoft IIs tilde directory enumeration

    漏洞标题: iis 短文件名列举漏洞     检测: https://code.google.com/p/iis-shortname-scanner-poc/   查看扫描出来的目录,全是404 ,比 ...

  6. 标准C程序设计七---111

    Linux应用             编程深入            语言编程 标准C程序设计七---经典C11程序设计    以下内容为阅读:    <标准C程序设计>(第7版) 作者 ...

  7. Lua开发环境搭建(Mac OS X)

    1. 安装Rudix Rudix: http://rudix.org curl -O https://raw.githubusercontent.com/rudix-mac/rpm/2015.4/ru ...

  8. jquery鼠标点击窗口或浮动层以外关闭层【阻止冒泡事件】

    $(".up-list a.th1").click(function(){ $(this).next("ul#up-list-ul").show(); }); ...

  9. CDOJ_327 BerOS file system

    原题地址:http://acm.uestc.edu.cn/#/problem/show/327 The new operating system BerOS has a nice feature. I ...

  10. 提高速度 history 的利用

    history的介绍history是shell的内置命令,其内容在系统默认的shell的man手册中.history是显示在终端输入并执行的过命令,系统默认保留1000条.[root@localhos ...