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 ...
随机推荐
- select2的远程加载非分页实例
$("#c01-select").select2({ ajax: { url: "data.json", dataType: 'json', delay: 25 ...
- C++ Queues(队列)
C++ Queues(队列) C++队列是一种容器适配器,它给予程序员一种先进先出(FIFO)的数据结构.1.back() 返回一个引用,指向最后一个元素2.empty() 如果队列空则返回真3.fr ...
- POJ 1845-Sumdiv(快速幂取模+整数唯一分解定理+约数和公式+同余模公式)
Sumdiv Time Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- ZOJ 1586 QS Network Kruskal求最小生成树
QS Network Sunny Cup 2003 - Preliminary Round April 20th, 12:00 - 17:00 Problem E: QS Network In the ...
- C# 写 LeetCode easy #1 Two Sum
1.Two Sum Given an array of integers, return indices of the two numbers such that they add up to a s ...
- mui 关闭当前窗口
在提交表单的时候,我们都需要关闭表单.需要关闭当前打开的窗口. bit.alert('提交成功' + (result.category.needAudit ? ",请耐心等待管理员审核信息后 ...
- 大白话5分钟带你走进人工智能-第二十六节决策树系列之Cart回归树及其参数(5)
第二十六节决策树系列之Cart回归树及其参数(5) 上一节我们讲了不同的决策树对应的计算纯度的计算方法, ...
- Python:asyncio模块学习
python asyncio 网络模型有很多中,为了实现高并发也有很多方案,多线程,多进程.无论多线程和多进程,IO的调度更多取决于系统,而协程的方式,调度来自用户,用户可以在函数中yield一个状态 ...
- PHP 数字补零 固定位数补0
在处理订单编号的时候,需要固定位数的数字,比如需要固定四位数格式: 1->0001 56->0056 288->0288 1992->1992 可以使用php内置函数str_p ...
- PHP SOAP 提交XML
<?php $xmldata = <<<EOT <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap. ...