首页 技术 正文
技术 2022年11月23日
0 收藏 650 点赞 4,708 浏览 2836 个字

仅仅须要推断一个回合就能够了,枚举推断能够一次出全然部牌或者大过对面的牌的可能,注意的是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;
}

微信扫一扫

支付宝扫一扫

本文网址:https://www.zhankr.net/140780.html

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:877 阅读:6,189
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:806 阅读:4,041
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:566 阅读:4,841
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:732 阅读:4,779
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:5,860
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:3,559
助力内容变现

将您的收入提升到一个新的水平

点击联系客服

在线时间:8:00-16:00

客服电话

400-888-8888

客服邮箱

ceotheme@ceo.com

扫描二维码

关注微信公众号

扫描二维码

手机访问本站