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 水题的更多相关文章

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

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

  2. Codeforces Gym 100269A Arrangement of Contest 水题

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

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

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

  4. 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 ...

  5. Codeforces Gym 100269B Ballot Analyzing Device 模拟题

    Ballot Analyzing Device 题目连接: http://codeforces.com/gym/100269/attachments Description Election comm ...

  6. Educational Codeforces Round 7 B. The Time 水题

    B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...

  7. Educational Codeforces Round 7 A. Infinite Sequence 水题

    A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...

  8. Codeforces Testing Round #12 A. Divisibility 水题

    A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...

  9. Codeforces Beta Round #37 A. Towers 水题

    A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received ...

随机推荐

  1. ECSHOP seo修改建议

    ECSHOP是一个非常优秀的商城程序,以丰富的模板.稳定开源.非常快的执行速度赢得广大网店主的青眯.可是新建站30多天,目前百度只收录了首页,而google收录正常.我检查了他的网站一切正常,没有任何 ...

  2. hdu 3635 Dragon Balls(加权并查集)2010 ACM-ICPC Multi-University Training Contest(19)

    这道题说,在很久很久以前,有一个故事.故事的名字叫龙珠.后来,龙珠不知道出了什么问题,从7个变成了n个. 在悟空所在的国家里有n个城市,每个城市有1个龙珠,第i个城市有第i个龙珠. 然后,每经过一段时 ...

  3. android总结

    针对Android有以下几点需要注意: 1.是不是应该把数据刷新操作放在onResume()中?     @Override     public void onResume() {          ...

  4. Easy steps to create a System Tray Application with C# z

    Hiding the C# application to the system tray is quiet straight forward. With a few line of codes in ...

  5. Linux--使用expect进行自动交互

    在linux下进行一些操作时,有时需要与机器进行一些交互操作,比如切换账号时输入账号密码,传输文件时输入账号密码登陆远程机器等,但有时候这些动作需要在shell脚本中进行,这个时候就可以使用expec ...

  6. .net高级技术(class0515)

    本次课程中讲的有的东西都是根据初学者的认知规律进行了调整,并不是严谨的,比如很多地方在多AppDomain条件下很多说法就不对了,但是说严谨了大家就晕了,因此继续不严谨的讲吧. 很多面试题都在这阶段的 ...

  7. bzoj 2095: [Poi2010]Bridges(二分法+混合图的欧拉回路)

    [题意] 给定n点m边的无向图,对于边u,v,从u到v边权为c,从v到u的边权为d,问能够经过每条边一次且仅一次,且最大权值最小的欧拉回路. [思路] 二分答案mid,然后切断权值大于mid的边,原图 ...

  8. [apkAnalyzer] 查看APK包名

    最近项目中要用到APK的包名,必应到apkAnalyzer这个软件可以用,下载解压后,看到这么些jar,bat文件不知道怎么用. 参考了这篇文章,看的也不甚明白,最后还是试出来了,这里记录一下. 首先 ...

  9. ArrayList、LinkedList、HashMap的遍历及遍历过程中增、删元素

    ArrayList.LinkedList.HashMap是Java中常用到的几种集合类型,遍历它们是时常遇到的情况.当然还有一些变态的时候,那就是在遍历的过程中动态增加或者删除其中的元素. 下面的例子 ...

  10. 使用SignalR实现比特币价格实时刷新

    ASP.NET SignalR是微软支持的一个运行在 Dot NET 平台上的 HTML Websocket 框架.它出现的主要目的是实现服务器主动推送(Push)消息到客户端页面,这样客户端就不必重 ...