codeforces Gym 100500H H. ICPC Quest 水题
Problem H. ICPC Quest
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/gym/100500/attachments
Description
Coach Fegla has invented a song effectiveness measurement methodology. This methodology in simple English means count the frequency of each character of the English letters [A-Z] in the given song (case insensitive). Get the top 5 characters with the highest frequencies, if 2 characters have the same frequency choose the one which is lexicographically larger. Sum up the indexes of these characters where the index of A is 0, index of B is 1, ..., index of of Z = 25. If this sum exceeds 62 print "Effective"otherwise print "Ineffective"without the quotes.
Input
The first line will be the number of test cases T. Each test case will consist of a series of words consisting only of upper or lower case English letters. Each test case ends with a line containing only "*"without the double quotes. Each word consists of a minimum of 1 letter and a max of 20 letters. The number of words in each test case will be a max of 20,000.
Output
For each test case print a single line containing: Case x: y x is the case number starting from 1. y is is the required answer either "Effective"or "Ineffective"without the quotes.
Sample Input
2 You can be the greatest * You can be the best You can be the King Kong banging on your chest *
Sample Output
Case 1: Effective Case 2: Ineffective
HINT
题意
让你统计频率最高的五个字母,然后看这些字母的值是否超过62
题解:
统计一下就好了……
代码
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
const int maxn=;
#define mod 1000000007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************* struct node
{
int x,y;
};
bool cmp(node a,node b)
{
if(a.x==b.x)
return a.y>b.y;
return a.x>b.x;
}
node a[];
string s;
int main()
{
int t=read();
for(int cas=;cas<=t;cas++)
{
memset(a,,sizeof(a));
for(int i=;i<;i++)
a[i].y=i;
while(cin>>s)
{
if(s[]=='*')
break;
for(int i=;i<s.size();i++)
{
if(s[i]>='a'&&s[i]<='z')
a[s[i]-'a'].x++;
if(s[i]>='A'&&s[i]<='Z')
a[s[i]-'A'].x++;
}
}
sort(a,a+,cmp);
int sum=;
for(int i=;i<;i++)
{
if(a[i].x!=)
sum+=a[i].y;
}
if(sum>)
printf("Case %d: Effective\n",cas);
else
printf("Case %d: Ineffective\n",cas);
}
}
codeforces Gym 100500H H. ICPC Quest 水题的更多相关文章
- 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 100269A  Arrangement of Contest 水题
		
Problem A. Arrangement of Contest 题目连接: http://codeforces.com/gym/100269/attachments Description Lit ...
 - 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 100500H A. Potion of Immortality 简单DP
		
Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/a ...
 - Codeforces Gym 100269B Ballot Analyzing Device 模拟题
		
Ballot Analyzing Device 题目连接: http://codeforces.com/gym/100269/attachments Description Election comm ...
 - Educational Codeforces Round 7 B. The Time 水题
		
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...
 - Educational Codeforces Round 7 A. Infinite Sequence 水题
		
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...
 - Codeforces Testing Round #12 A. Divisibility 水题
		
A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...
 - Codeforces Beta Round #37 A. Towers 水题
		
A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received ...
 
随机推荐
- Oracle 不同故障的恢复方案
			
之前在Blog中对RMAN 的备份和恢复做了说明,刚看了下,在恢复这块还有知识点遗漏了. 而且恢复这块很重要,如果DB 真要出了什么问题,就要掌握对应的恢复方法. 所以把DB的恢复这块单独拿出来说明一 ...
 - 翻译【ElasticSearch Server】第一章:开始使用ElasticSearch集群(4)
			
停止ElasticSearch(Shutting down ElasticSearch) 尽管我们期望集群(或节点)终生完美运行,我们最终可能需要重启或者正确的停止它(例如,维护).有三种方式来停止E ...
 - Color Length
			
题意: 给出两个字符串,求把两字符串组成一个字符串使的字符串中的相同字母的最远距离的和最小. 分析: 本题关键在于怎么计算距离和的方法上.dp[i][j]表示处理到长度i的a串,长度j的b串还需要的计 ...
 - 【转】OFBiz安全组
			
安全组标识 描述 用户系统级别BIZADMIN 全部商业应用程序权限组,具有全部商业应用程序管理权限,不是技术人员权限. bizadmin FLEXADMIN 缓存管理组,具有全部颗粒的权限. fle ...
 - 【剑指offer 面试题13】在 O(1) 时间删除链表结点
			
#include <iostream> using namespace std; //构造链表结点 struct ListNode { int val; ListNode *next; L ...
 - ASP.NET 日期 时间 年 月 日 时 分 秒 格式及转换
			
在平时编码中,经常要把日期转换成各种各样的形式输出或保持,今天专门做了个测试,发现DateTime的ToString()方法居然有这么多的表现形式,和大家一起分享. DateTime time=Dat ...
 - Hadoop 学习之 FAQ
			
在Hadoop的学习与使用过程中同样如此.这里为大家分享Hadoop集群设置中经常出现的一些问题,以下为译文: 1.Hadoop集群可以运行的3个模式? 单机(本地)模式 伪分布式模式 全分布式模式 ...
 - MSI/MSI-X
			
MSI PCI2.2规范引进了MSI作为传统的基于线的中断的替代方案.MSI允许设备通过向一个特定的地址写入一个特定的值来允许中断,而不是使用一个专有的引脚来触发中断.注意消息的目的地址和消息数据被当 ...
 - Binder机制
			
在Android系统的Binder机制中,由一系统组件组成,分别是Client.Server.Service Manager和Binder驱动程序,其中Client.Server和Service Ma ...
 - Chapter 1 初探Caffe
			
首先下载windows下源码: Microsoft 官方:GitHub - Microsoft/caffe: Caffe on both Linux and Windows 官方源码使用Visual ...