codeforce Gym 100500I Hall of Fame (水)
题意:统计一些串中,字母的出现频率,不分大小写,找出现频率最高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 (水)的更多相关文章
- codeforce Gym 100500C ICPC Giveaways(水)
读懂题意就是水题,按照出现次数对下标排一下序,暴力.. #include<cstdio> #include<algorithm> #include<cstring> ...
- codeforces Gym 100500C D.Hall of Fame 排序
Hall of Fame Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachmen ...
- Codeforce Gym 100015I Identity Checker 暴力
Identity Checker 题目连接: http://codeforces.com/gym/100015/attachments Description You likely have seen ...
- codeforces Gym 100187H H. Mysterious Photos 水题
H. Mysterious Photos Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- codeforces Gym 100500H H. ICPC Quest 水题
Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/a ...
- codeforce gym/100495/problem/K—Wolf and sheep 两圆求相交面积 与 gym/100495/problem/E—Simple sequence思路简述
之前几乎没写过什么这种几何的计算题.在众多大佬的博客下终于记起来了当时的公式.嘚赶快补计算几何和概率论的坑了... 这题的要求,在对两圆相交的板子略做修改后,很容易实现.这里直接给出代码.重点的部分有 ...
- Gym 100646 Problem E: Su-Su-Sudoku 水题
Problem E: Su-Su-Sudoku/center> 题目连接: http://codeforces.com/gym/100646/attachments Description By ...
- Codeforces Gym 100513F F. Ilya Muromets 水题
F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/probl ...
- Codeforces Gym 100269A Arrangement of Contest 水题
Problem A. Arrangement of Contest 题目连接: http://codeforces.com/gym/100269/attachments Description Lit ...
随机推荐
- 4.ctf实战题
一道ctf实战题. 先亮出网址: http://fb2ad00f-0a28-4e38-8fff-849d7391e2d0.coding.io 打开连接,看到下面页面.Web题,首先就是扫描(御剑啊还有 ...
- Manacher's Algorithm 马拉车算法(最长回文串)
这个马拉车算法Manacher‘s Algorithm是用来查找一个字符串的最长回文子串的线性方法,由一个叫Manacher的人在1975年发明的,这个方法的最大贡献是在于将时间复杂度提升到了线性,这 ...
- 数据库路由中间件MyCat - 源代码篇(1)
此文已由作者张镐薪授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 进入了源代码篇,我们先从整体入手,之后拿一个简单流程前端连接建立与认证作为例子,理清代码思路和设计模式.然后 ...
- ue4 weapon
UE4版本4.17,不同版本api可能有差异 静态 1 在骨骼上加socket 在socket上右键-添加浏览资源-找到要添加的那个道具(这个只用来看效果,调位置,不会显示到最终效果中),调整sock ...
- 洛谷P1137 旅行计划
P1137 旅行计划 题目描述 小明要去一个国家旅游.这个国家有N个城市,编号为1-N,并且有M条道路连接着,小明准备从其中一个城市出发,并只往东走到城市i停止. 所以他就需要选择最先到达的城市,并制 ...
- 手动配置 FreeBSD 网络
设置 IP 地址和网关 编辑 /etc/rc.conf $ sudo vim /etc/rc.conf # 设置ip地址和子网掩码 ifconfig_em0="inet 192.168.0. ...
- 命令行下载工具 wget
wget 是一个简单而强大的跨平台命令行下载工具,包括 Windows 也有对应的版本.全称 GNU Wget,属于 GNU 计划的一部分,自由软件.支持 HTTP.HTTPS 和 FTP 协议,可在 ...
- 开发中mybatis的一些常见问题记录
一.oracle数据库通过mybatis的批量插入的两种方式 方式1 insert into table_tmp (id,v1,v2,v3,v4) SELECT A.*,OSM_VIID_DEVICE ...
- opencv作业
作业下载地址: 链接:http://pan.baidu.com/s/1qYQnbkw 密码:v7y9
- 天上掉馅饼 期望DP
C 天上掉馅饼文件名 输入文件 输出文件 时间限制 空间限制bonus.pas/c/cpp bonus.in bonus.out 1s 128MB题目描述小 G 进入了一个神奇的世界,在这个世界,天上 ...