暴力 BestCoder Round #41 1001 ZCC loves straight flush
/*
m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换
╰·
*/
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f; int main(void) //BestCoder Round #41 1001 ZCC loves straight flush
{
//freopen ("A.in", "r", stdin); int t;
scanf ("%d", &t);
while (t--)
{
int c[], d[], m[][];
memset (m, , sizeof (m));
string s;
for (int i=; i<; ++i)
{
cin >> s; c[i] = s[] - 'A';
if (s.size () == ) d[i] = s[] - '';
else d[i] = + s[] - '';
m[c[i]][d[i]]++;
} int mn = INF;
for (int i=; i<; ++i)
{
int d = c[i];
for (int j=; j<=; ++j)
{
int cnt = ;
for (int k=j; k<j+; ++k)
{
int x = k;
if (x == ) x = ;
if (m[d][x] == ) cnt++;
}
mn = min (mn, - cnt);
}
} printf ("%d\n", mn);
} return ;
}
暴力 BestCoder Round #41 1001 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 ...
- 字符串处理 BestCoder Round #43 1001 pog loves szh I
题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #incl ...
- hdu 5288 ZCC loves straight flush
传送门 ZCC loves straight flush Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K ...
- 暴力 BestCoder Round #46 1001 YJC tricks time
题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...
- 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
T1:ZCC loves straight flush(hdu 5228) 题目大意: 给出5张牌,问至少替换多少张牌可以构成同花顺. 题解: 1.直接枚举所有同花顺(枚举花色A-D和最小的数字1-1 ...
- 贪心 BestCoder Round #39 1001 Delete
题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...
- 贪心/二分查找 BestCoder Round #43 1002 pog loves szh II
题目传送门 /* 贪心/二分查找:首先对ai%=p,然后sort,这样的话就有序能使用二分查找.贪心的思想是每次找到一个aj使得和为p-1(如果有的话) 当然有可能两个数和超过p,那么an的值最优,每 ...
- BestCoder Round #75 1001 - King's Cake
Problem Description It is the king's birthday before the military parade . The ministers prepared a ...
随机推荐
- C++中extern “C”含义深层探索(在原作的基础上修改) .
1. 引言 C++ 语言的创建初衷是“a better C” ,但是这并不意味着C++ 中类似C 语言的全局变量和函数所采用的编译和连接方式与C 语言完全相同.作为一种欲与C 兼容的语言,C++ 保留 ...
- 在Java中如何编写回调函数,以及回调函数的简单应用
import static java.lang.System.out; import static java.lang.System.err; import java.util.logging.Lev ...
- QT实现FTP服务器(一)
QListenSocket类的实现: #include "QListenSocket.h" #include <QTcpSocket> #include <QDe ...
- navcat for mysql 连接远程数据库 教程
1.首先进入数据库: mysql -uroot -p 2.然后打开数据库设置远程连接权限: mysql>GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'ID ...
- 进程调度函数schedule()分析
1.功能简述: 最主要作用就是 从就绪进程中选择一个优先级最高的进程来代替当前进程运行. 2.代码分析 schedule(); struct task_struct *tsk = cur ...
- MySQL的IFNULL简单使用说明
MySQL IFNULL函数简介 MySQL IFNULL函数是MySQL控制流函数之一,它接受两个参数,如果不是NULL,则返回第一个参数. 否则,IFNULL函数返回第二个参数. 两个参数可以是文 ...
- html5--6-11 CSS选择器7--伪类选择器
html5--6-11 CSS选择器7--伪类选择器 #E:target 选择当前活动的锚点元素. 学习要点 掌握常用的CSS选择器 了解不太常用的CSS选择器 什么是选择器 当我们定义一条样式时候, ...
- 在canvas标签和style中定义width和height
在canvas标签中定义width.height跟在style中定义width.height是不同的.canvas标签的width和height是画布实际宽度和高度,就是在这个上面绘制图形.style ...
- [Codeforces 914D] Bash and a Tough Math Puzzle
[题目链接] https://codeforces.com/contest/914/problem/D [算法] 显然 , 当一个区间[l , r]中为d倍数的数的个数 <= 1 , 答案为Ye ...
- bzoj 1510 Kra-The Disks —— 思路
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1510 一个位置比上面还宽就没用了,而且会收到上面的限制,所以跟上面取 min 即可: 然后维 ...