#include<stdio.h>
#include<string.h>
int hash[*];
int main(){
int t;
scanf("%d",&t);
while(t--){
char ch;
int num;
memset(hash,,sizeof(hash));
for(int i = ;i<;i++){
scanf(" %c",&ch);
scanf("%d",&num);
num--;//下标要从0开始
hash[*num+ch-'A']++;//hash,0-->1A,1-->1B,2-->1C......
}
int ans = ;
for(int i = ;i<;i++){//下标到9就好了,因为k会枚举后面4个的
for(int j = ;j<;j++){
int temp = ;
for(int k = ;k<;k++){
int index = (i+k)*+j;
if(hash[index%(*)])//这里取余是当枚举到13A、13B的时候,取余回到1A、1B...
temp--;
}
ans = ans<temp?ans:temp;
}
}
printf("%d\n",ans);
}
return ;
}

HDU 5228的更多相关文章

  1. HDU 5228 ZCC loves straight flush 暴力

    题目链接: hdu:http://acm.hdu.edu.cn/showproblem.php?pid=5228 bc(中文):http://bestcoder.hdu.edu.cn/contests ...

  2. HDU 5228 ZCC loves straight flush( BestCoder Round #41)

    题目链接:pid=5228">ZCC loves straight flush pid=5228">题面: pid=5228"> ZCC loves s ...

  3. hdu 5228 OO’s Sequence(单独取数算贡献)

    Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the number o ...

  4. hdu 5228 枚举

    题意:在前往ZJOI2015一试的路上,ZCC在同Fsygd打德州扑克时输光了所有的筹码.不过ZCC最近学会了一些黑技术.现在,他能够在游戏过程中更换任何他想要更换的牌.ZCC想要通过更换尽量少的牌得 ...

  5. BestCoder Round #41

    T1:ZCC loves straight flush(hdu 5228) 题目大意: 给出5张牌,问至少替换多少张牌可以构成同花顺. 题解: 1.直接枚举所有同花顺(枚举花色A-D和最小的数字1-1 ...

  6. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  7. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  8. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  9. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

随机推荐

  1. C++ Virtual

    摘自:http://www.cnblogs.com/xd502djj/archive/2010/09/22/1832912.html namespace QCAR { /// Area is the ...

  2. ubuntu14.04设置开机亮度

    1 查看自己的系统亮度的最大值: cd /sys/class/backlight 笔记本的显卡型号不同->亮度调节文件夹名会不同. 2 我的是intel_backlight cd intel_b ...

  3. python 动态调用模块、类、方法(django项目)

    需求:近一段时间基于django框架,开发各业务层监控代码,每个业务的监控逻辑不同,因此需要开发监控子模块,动态的导入调用. 项目名称:demo_django App:common_base.moni ...

  4. 10月17日下午MySQl数据库CRUD高级查询

    高级查询:1.连接查询 #适用于有外键关系的  没有任何关系没法用select * from Info,Nation #同时查询这俩表并把两表每个数据相互组合,形成笛卡尔积 select * from ...

  5. Spring MVC学习笔记——给Controller和视图传值

    一.给Controller传值,值将显示在控制台 1.第一种:使用@RequestParam,改HelloController.java //RequestMapping表示用哪一个url来对应 @R ...

  6. Java数据结构——栈

    //================================================= // File Name : Stack_demo //-------------------- ...

  7. PHP----遇到的Session问题

    使用SESSION,当跨页面使用时,会提示错误Cannot modify header information - headers already sent by..., 背景:使用session_s ...

  8. jsp机制基础

    JSP 和Servlet技术一样,JSP也是SUN公司定义的一种开发动态web资源的技术,属于JavaEE技术之一.JSP实际上就是Servlet,它们在一起又称JSP/Servlet规范. Serv ...

  9. jQuery checkbox 所有 全选、全不选、是否选中等

    下面是网络收集: jquery判断checked的三种方法:.attr('checked):   //看版本1.6+返回:”checked”或”undefined” ;1.5-返回:true或fals ...

  10. MVC学习笔记一

    主要是为了复习昨天所学习到的MVC的基础内容,因为昨天还在申请博客,所以今天补上. 目前主要学习资料是<ASP.NET MVC4 Web 编程> 首先先来一个MVC请求的路径的流程说明. ...