[NWRRC2013] Arrangement of Contest(模拟)

题面翻译

题目描述

小D和小P想要举行比赛。

他们收到了许多建议书,现在他们想要从这些报名书中挑选一些好的建议。

他们采纳的建议符合以下标准:第一个建议的开头为A,第二个建议的开头为B,以此类推。

请你帮助他们,确定他们所能采纳的建议的最大数量。

输入格式

第一行,一个正整数 n n n,表示建议数。

2 2 2 n + 1 n+1 n+1 行,一行一个字符串,表示建议名称。

输出格式

一个整数,表示他们所能采纳的建议的最大数量。

说明/提示

对于 100 % 100\% 100% 的数据, 1 ≤ n ≤ 100 1\leq n \leq 100 1n100

题目描述

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

输入格式

The first line contains single integer n n n – the number of problem proposals received by the little brothers ( 1 ≤ n ≤ 100 ) (1 \le n \le 100) (1n100) .

Next n n n lines contain titles of proposed problems, one per line. The length of each title does not exceed 30 30 30 characters. Each title starts with an uppercase letter and contains only English letters, digits and underscores.

输出格式

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

样例 #1

样例输入 #1

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

样例输出 #1

12

样例 #2

样例输入 #2

3
Snow_White_and_the_7_Dwarfs
A_Problem
Another_Problem

样例输出 #2

1

样例 #3

样例输入 #3

2
Good_Problem
Better_Problem

样例输出 #3

0

提示

Time limit: 2 s, Memory limit: 256 MB.

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define inf 1e18
const int mod=1e9+7;
const int N=2e5+5;
int n,a[N];
void solve(){
	cin>>n;
	string s;
	for(int i=1;i<=n;i++){
		cin>>s;
		a[s[0]-'A']++;
	}
	for(int i=0;i<=26;i++){
		if(a[i]==0){
			cout<<i;
			return;
		}
	}
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int tt=1;
//	cin>>tt;
	while(tt--) solve();
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值