Problem A. Arrangement of Contest

题目连接:

http://codeforces.com/gym/100269/attachments

Description

Little Dmitry and little Petr want to arrange a contest. Their little friends submitted several task

proposals and now Dmitry and Petr want to select some of them for the contest. As they are just little

boys, they cannot estimate quality of tasks, but they know for sure that in good contest title of the first

problem starts with A, the title of the second one — with B, and so on.

Given titles of the proposed tasks, help little brothers to determine the maximal number of problems in

a good contest they can arrange.

Input

The first line contains single integer n — the number of problem proposals received by the little

brothers (1 ≤ n ≤ 100).

Next n lines contain titles of proposed problems, one per line. The length of each title does not exceed

30 characters. Each title starts with an uppercase letter and contains only English letters, digits and

underscores.

Output

Output a single number — the maximal number of problems in a good contest. In case there is no good

contest that may be arranged, output 0.

Sample Input

12

Arrangement of Contest

Ballot Analyzing Device

Correcting Curiosity

Dwarf Tower

Energy Tycoon

Flight Boarding Optimization

Garage

Heavy Chain Clusterization

Intellectual Property

J

Kids in a Friendly Class

Lonely Mountain

Sample Output

12

Hint

题意

问这些句子的首字母最长连接到什么位置……

题解:

阅读题

代码

#include<bits/stdc++.h>
using namespace std; int num = 0;
int ans = 0;
string s;
int vis[30];
int main()
{
freopen("arrange.in","r",stdin);
freopen("arrange.out","w",stdout);
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
cin>>s;
vis[s[0]-'A']=1;
}
for(int i=0;i<27;i++)
if(vis[i]==0)
{
cout<<i<<endl;
return 0;
}
}

Codeforces Gym 100269A Arrangement of Contest 水题的更多相关文章

  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 100500H H. ICPC Quest 水题

    Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/a ...

  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. Educational Codeforces Round 7 B. The Time 水题

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

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

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

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

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

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

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

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

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

  9. Codeforces - 1194B - Yet Another Crosses Problem - 水题

    https://codeforc.es/contest/1194/problem/B 好像也没什么思维,就是一个水题,不过蛮有趣的.意思是找缺黑色最少的行列十字.用O(n)的空间预处理掉一维,然后用O ...

随机推荐

  1. sicily 1153. 马的周游问题

    一.题目描述 在一个8 * 8的棋盘中的某个位置有一只马,如果它走29步正好经过除起点外的其他位置各一次,这样一种走法则称马的周游路线,试设计一个算法,从给定的起点出发,找出它的一条周游路线. 为了便 ...

  2. 005 JAVA多线程和并发基础面试问答(转载)

    原文链接:http://ifeve.com/java-multi-threading-concurrency-interview-questions-with-answers/ 多线程和并发问题是Ja ...

  3. hadoop InputFormat 类别

    FileInputFormat是所有使用文件作为数据源的InputFormat的积累.它提供两个功能:一个是定义哪些文件包含在一个作业的输入中:一个为输入文件生成分片的实现.自动将作业分块 作业分块大 ...

  4. swift中闭包的循环引用

    首先我们先创造一个循环引用 var nameB:(()->())? override func viewDidLoad() { super.viewDidLoad() let bu = UIBu ...

  5. xcode 配置系统环境变量 Preporocessing 预编译宏的另一种写法, 系统的DEBUG 由来

    在某些项目中看到一些环境变量类似宏的东西 比如叫ENVIRONMENT, 但发现还找不到具体这个宏是什么值, 那是因为他实在Preprocessing里配置了这个宏的值, 他能配置debug/rele ...

  6. SAE如何使用Git

    了解Git及远程git仓库 请先看博文<Git入门及上传项目到github中>,弄懂了之后我相信我下面说的就相当于废话了. SAE的git远程仓库就相当于github. 向SAE的远程仓库 ...

  7. 关于eclipase出现的problems during content assist报错问题

    解决办法: 把下面箭头指的地方改为上面箭头的指向

  8. P2511 [HAOI2008]木棍分割

    目录 Description Solution Code Description 有n根木棍, 第i根木棍的长度为Li,n根木棍依次连结了一起, 总共有n-1个连接处. 现在允许你最多砍断m个连接处, ...

  9. Oracle数据库共享内存分配不足问题的解决

    问题: ORA-: unable to allocate bytes of shared memory ("shared pool,)","session param v ...

  10. canvas 进入游戏点击时苹果手机为什么会闪

    canvas 进入游戏点击时苹果手机为什么会闪 ?? 大神门 谁有解决办法???