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 ...
随机推荐
- 23.Consent 代码重构
新建Services文件,并新建类ConsentService类把,ConsetController里面不是Action的方法都放在这个ConsentService类里面 先把构造函数完善 把这些私有 ...
- jquery中的$.ajax()的源码分析
针对获取到location.href的兼容代码: try { ajaxLocation = location.href; } catch( e ) { // Use the href attribut ...
- 新手必看】Highcharts的100个基础问答
新手必看]Highcharts的100个基础问答 2014-12-2 10:59| 发布者: Mr.Zhang| 查看: 2749| 评论: 3|来自: Highcharts中文论坛 摘要: 1. ...
- Fiddler如何抓取HTTPS协议的网页
Fiddler默认只能抓取HTTP协议的网页,不能抓取HTTPS协议的网页,而我们很多时候,都需要抓HTTPS协议的网页,比如抓淘宝数据等.今天,韦玮老师会为大家讲解如何使用Fiddler抓取HTTP ...
- Keras实现MNIST分类
仅仅为了学习Keras的使用,使用一个四层的全连接网络对MNIST数据集进行分类,网络模型各层结点数为:784: 256: 128 : 10: 使用整体数据集的75%作为训练集,25%作为测试 ...
- js混杂笔记
1.判断对象为空的方法 1)Object.keys({}).length === 0 // true 2)Object.getOwnPropertyNames({}).length === 0 // ...
- 51nod1153(dfs/单调队列)
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1153 题意:中文题诶- 思路:一个比较简单的方法是dfs隐式 ...
- java中对List进行分组和排序
排序 对List进行排序,有两种办法 第一个是用java提供的工具类Collections提供的sort方法进行排序 废话不多说,上代码 首先定义一个Student public class Stud ...
- Linux常用命令(补充)-grep
grep(global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正 ...
- PAT甲级——1103 Integer Factorization (DFS)
本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90574720 1103 Integer Factorizatio ...