题意:统计一些串中,字母的出现频率,不分大小写,找出现频率最高5个字符(相同频率优先取字典序大的),把他们的对应的值加起来判断以下是否大于62。

没出现的不算。

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll; char str[];
int cnt[]; bool cmp(int a,int b) { return cnt[a]>cnt[b] || ( cnt[a] == cnt[b] && a > b ); } int main()
{
int T;
scanf("%d",&T);getchar();
for(int k = ; k <= T; k++){
memset(cnt,,sizeof(cnt));
while(~scanf("%s",str)&&(*str)!='*'){
int len = strlen(str);
for(int i = ; i < len; i++){
char ch = str[i];
if('a'<=ch&&ch<='z'){
cnt[ch-'a']++;
}else
if('A'<=ch&&ch<='Z'){
cnt[ch-'A']++;
}
}
}
int r[];
for(int i = ; i < ; i++) { r[i] = i; }
sort(r,r+,cmp);
int sum = ;
for(int i = ; i < ; i++) {
if(cnt[r[i]])
sum += r[i];
}
printf("Case %d: %s\n",k,sum>?"Effective":"Ineffective");
}
return ;
}

codeforce Gym 100500I Hall of Fame (水)的更多相关文章

  1. codeforce Gym 100500C ICPC Giveaways(水)

    读懂题意就是水题,按照出现次数对下标排一下序,暴力.. #include<cstdio> #include<algorithm> #include<cstring> ...

  2. codeforces Gym 100500C D.Hall of Fame 排序

    Hall of Fame Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachmen ...

  3. Codeforce Gym 100015I Identity Checker 暴力

    Identity Checker 题目连接: http://codeforces.com/gym/100015/attachments Description You likely have seen ...

  4. codeforces Gym 100187H H. Mysterious Photos 水题

    H. Mysterious Photos Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...

  5. codeforces Gym 100500H H. ICPC Quest 水题

    Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/a ...

  6. codeforce gym/100495/problem/K—Wolf and sheep 两圆求相交面积 与 gym/100495/problem/E—Simple sequence思路简述

    之前几乎没写过什么这种几何的计算题.在众多大佬的博客下终于记起来了当时的公式.嘚赶快补计算几何和概率论的坑了... 这题的要求,在对两圆相交的板子略做修改后,很容易实现.这里直接给出代码.重点的部分有 ...

  7. Gym 100646 Problem E: Su-Su-Sudoku 水题

    Problem E: Su-Su-Sudoku/center> 题目连接: http://codeforces.com/gym/100646/attachments Description By ...

  8. Codeforces Gym 100513F F. Ilya Muromets 水题

    F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/probl ...

  9. Codeforces Gym 100269A Arrangement of Contest 水题

    Problem A. Arrangement of Contest 题目连接: http://codeforces.com/gym/100269/attachments Description Lit ...

随机推荐

  1. Object有哪些公用的方法?

    Object是所有类的父类,任何类都默认继承Object. public class Demo { public static void main(String[] args) { Object ob ...

  2. starUML建立时序图

    对于经常看项目代码或者写项目的人.时序图可以帮助理解.记录项目.设计项目等用途. 1.starUml下载安装比较简单,这里不再赘述.打开starUml 2. 在Model Explorer 中,在Un ...

  3. 7.13实习培训日志 Docker

    静态博客github地址 静态博客github地址轻量版 Docker Docker镜像 Docker镜像概念 Docker镜像下载时的分层体现:一层层下载,下载过程中给出了每一层的 ID 的前 12 ...

  4. PHP注释-----PHPDOC

    用过IDE或看过其他源码的小伙伴们应该都见过类似下面这样的注释   /** * 递归获取所有游戏分类 * @param int $id * @return array */ 看得多了就大概知道了一些规 ...

  5. 模拟一则ORA-600 [4194][][]故障并处理

    环境:OEL 5.7 + Oracle 11.2.0.3 1.模拟ORA-600 [4194][][]故障 2.使用bbed处理 3.尝试启动数据库 1.模拟ORA-600 [4194][][]故障 ...

  6. firefly

    firefly (9秒社团-游戏服务端开源引擎) 编辑 Firefly是免费.开源.稳定.快速扩展.能 “热更新”的分布式游戏服务器端框架,采用Python编写,基于Twisted框架开发.它包括了开 ...

  7. 2017-9-20 NOIP模拟赛

    A 约数之和 (count.pas/c/cpp)TL:1S ML:128MB[Description]我们用 D(x)表示正整数 x 的约数的个数.给定一个正整数 N,求 D(1)+D(2)+…+D( ...

  8. To the max(求最大子矩阵和)

    To the Max Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 47985   Accepted: 25387 Desc ...

  9. 关于Struts漏洞工具的使用

    最新struts-scan资源: https://www.cesafe.com/3486.html 一,将资源下载后,放入liunx系统中,并且需要具备python2的操作环境 二,打开终端使用如下命 ...

  10. docker 使用数据库mysql

    1. docker pull mysql  获取mysql镜像 2. docker images 查看镜像列表 3.  docker run -itd -P mysql bash :启动mysql镜像 ...