暴力 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 ...
随机推荐
- 区分虚拟机和machine simulator
1 虚拟机和machine simulator的不同 虚拟机是让多个操作系统同时共用现有的硬件架构,它不会模拟新的硬件架构.qemu这样的模拟器是模拟新的硬件架构,这个架构和host不同.
- 答案{{index==0 ? '一' : (index==1 ? '二':'三' )}}
答案{{index==0 ? '一' : (index==1 ? '二':'三' )}}
- swift的String处理
import UIKit import CoreText class ViewController: UIViewController { override func viewDidLoad() { ...
- Java中需要了解的点
1.32位jvm.64位区别? 2.
- web中使用svg失量图形及ie8以下浏览器的处理方式
直接上代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <me ...
- dns服务器报错解决
搭了个dns服务器,配置完毕老是报错,这里总结一下常见思路: ①关闭firewalld ②关闭selinux ③/var/named里面的配置文件所属用户组是否是root:named ④named.c ...
- MYSQL进阶学习笔记十:MySQL慢查询!(视频序号:进阶_23-24)
知识点十一:MySQL 慢查询的应用(23) 一.慢查询定义 MySQL记录下查询超过指定时间的语句,我们将超过指定时间的SQL语句查询称为慢查询. 查看时间限制 show variables lik ...
- contents属性
CALayer 有一个属性叫做contents,这个属性的类型被定义为id,意味着它可以是任何类型的对象.在这种情况下,你可以给contents属性赋任何值,你的app仍然能够编译通过.但是,在实践中 ...
- 创建Android本地repo
/**************************************************************************** * 创建Android本地repo * 说明 ...
- bzoj 4756 Promotion Counting —— 线段树合并
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4756 合并子树的权值线段树: merge 返回 int 或者是 void 都可以. 代码如下 ...