hdu 5288 ZCC loves straight flush
ZCC loves straight flush
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 1038 Accepted Submission(s): 429
We call a five-card hand a Straight Flush when all five cards are consecutive and of the same suit. You are given a five-card hand. Please tell ZCC how many cards must be changed so as to get a Straight Flush.
Cards are represented by a letter('A', 'B', 'C', 'D') which denotes the suit and a number('1', '2', ⋯
, '13') which denotes the rank.
Note that number '1' represents ace which is the largest actually. "1 2 3 4 5" and "10 11 12 13 1" are both considered to be consecutive while "11 12 13 1 2" is not.
which denotes the number of test cases.
For each test case, there are five short strings which denote the cards in a single line. It's guaranteed that all five cards are different.
A1 A2 A3 A4 A5
A1 A2 A3 A4 C5
A9 A10 C11 C12 C13
1
2
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <stack>
#include <cctype>
#include <vector>
#include <cmath>
#include <map>
#include <queue> #define ll long long using namespace std; int T;
int mi;
char s[];
int t[][]; void solve()
{
int i,j,k;
int p;
for(i = ;i < ;i++){
for(j = ;j <= ;j++ ){
p = ;
for(k = ;k <= ;k++){
if(t[i][ (j+k-)%+ ]){
p++;
}
}
mi = min(mi, - p);
}
}
} int main()
{
//freopen("in.txt","r",stdin);
scanf("%d",&T);
for(int ccnt=;ccnt<=T;ccnt++){
//while(scanf("%d%s%s",&n,a,b)!=EOF){
mi = ;
int i;
int v;
memset(t,,sizeof(t));
for(i = ;i <= ;i++){
scanf("%s",s);
v = s[] - '';
if(strlen(s) == ){
v*=;
v+=s[] - '';
}
t[ s[] - 'A' ][ v ] = ;
}
solve();
printf("%d\n",mi);
}
return ;
}
hdu 5288 ZCC loves straight flush的更多相关文章
- HDU 5228 ZCC loves straight flush( BestCoder Round #41)
题目链接:pid=5228">ZCC loves straight flush pid=5228">题面: pid=5228"> ZCC loves s ...
- HDU 5228 ZCC loves straight flush 暴力
题目链接: hdu:http://acm.hdu.edu.cn/showproblem.php?pid=5228 bc(中文):http://bestcoder.hdu.edu.cn/contests ...
- 暴力 BestCoder Round #41 1001 ZCC loves straight flush
题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include < ...
- HDU 4876 ZCC loves cards(暴力剪枝)
HDU 4876 ZCC loves cards 题目链接 题意:给定一些卡片,每一个卡片上有数字,如今选k个卡片,绕成一个环,每次能够再这个环上连续选1 - k张卡片,得到他们的异或和的数,给定一个 ...
- hdu 4873 ZCC Loves Intersection(大数+概率)
pid=4873" target="_blank" style="">题目链接:hdu 4873 ZCC Loves Intersection ...
- hdu 4876 ZCC loves cards(暴力)
题目链接:hdu 4876 ZCC loves cards 题目大意:给出n,k,l,表示有n张牌,每张牌有值.选取当中k张排列成圈,然后在该圈上进行游戏,每次选取m(1≤m≤k)张连续的牌,取牌上值 ...
- HDU 4873 ZCC Loves Intersection(可能性)
HDU 4873 ZCC Loves Intersection pid=4873" target="_blank" style="">题目链接 ...
- hdu 4882 ZCC Loves Codefires(数学题+贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4882 ------------------------------------------------ ...
- HDU 4882 ZCC Loves Codefires (贪心)
ZCC Loves Codefires 题目链接: http://acm.hust.edu.cn/vjudge/contest/121349#problem/B Description Though ...
随机推荐
- Luogu P5352 Terrible Homework
神仙@TheLostWeak出的题,因为他最近没时间所以我先写一下sol(其实我也没什么时间) 作为一道简单的数据结构题想必大家都能看出必须用LCT维护信息吧 一个朴素的想法就是直接维护四种操作的值, ...
- JSONP 跨域请求 - 获取JSON数据
如何用原生方式使用JSONP? 下边这一DEMO实际上是JSONP的简单表现形式,在客户端声明回调函数之后,客户端通过script标签向服务器跨域请求数据,然后服务端返回相应的数据并动态执行回调函数. ...
- CPP-网络/通信:SOCKET
客户端实现代码: //引入头文件 #include <WinSock2.h> //客户端创建Socket////////////////////////////////////////// ...
- GYM 101604 || 20181010
看着前面咕咕咕的国庆集训 难受 十月十日要萌一天哇www A.字符串 题意:给定一个字符串 问能否交换两个字符或者不交换字符,使其成为回文串 之前写的太丑 重写一遍加一堆 if 竟然过了w 思路:求出 ...
- fckeditor的实例
第一步:去官网下载,删除多余的包 删除所有”_”开头的文件和文件夹 删除FCKeditor的目录下: fckeditor.afp fckedit ...
- Java InputStream、String、File相互转化
String --> InputStreamByteArrayInputStream stream = new ByteArrayInputStream(str.getBytes()); Inp ...
- history.pushState 实现浏览器页面不刷新修改url链接
最近遇到了在不刷新页面的情况下修改浏览器url链接的需求,遂求助于万能的度娘,最终通过history.pushState()完美解决问题.现在将我理解的一些内容分享一下,不对的地方欢迎大家指出. 在使 ...
- atlas 日志分析脚本
#!/usr/bin/env python # encoding: utf-8 #@author: 东哥加油! #@file: log_analyze.py #@time: 2018/8/23 17: ...
- Ecshop的积分商城-对不起,该商品库存不足,现在不能兑换
1. 打开Ecshop积分商城文件 "根目录/exchange.php" 发现248行与289行都有库存不足时报错的提示代码: 248行: /* 查询:检查兑换商品是否有库 ...
- 【php】 php能做什么
来源:php官方文档 网站和 web 应用程序(服务器端脚本) 命令行脚本 桌面(GUI)应用程序 相信大多数人都不知道第三种,用php竟然可以写GUI,当然是基于PHP-GTK扩展写的