UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#157445#985. 统计选票szzhj1000ms1224kbC++470b2022-08-11 19:02:382022-08-11 19:02:39

answer

#include<bits/stdc++.h>
using namespace std;
char str[2000];
int sum[27];
int main()
{
	int n,len=0;
	cin>>n;
	char s;
	scanf("%s",str);
	
	while(str[len]!='#')
	{
		if(str[len]-65<n && str[len]-65>=0)
		{
			sum[str[len]-65]++;
		}
		if(str[len]-97<n && str[len]-97>=0)
		{
			sum[str[len]-97]++;
		}
		len++;
	}

	for(int i=0;i<n;i++)
	{
		s=65+i;
		cout<<s<<":"<<sum[i]<<endl;
		len=len-sum[i];
	}
	cout<<"OO:"<<len<<endl;
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 50
Accepted
time: 0ms
memory: 1224kb

input:

3
aacCABBCgljeacd#

output:

A:4
B:2
C:4
OO:5

result:

ok 4 lines

Test #2:

score: 50
Accepted
time: 0ms
memory: 1224kb

input:

8
abcsdbbbccccdddeeefffggghhiijjjhhhaasldkfjiooociONKKLFKWNSNLNVLAKEO#

output:

A:4
B:4
C:6
D:5
E:4
F:5
G:3
H:5
OO:31

result:

ok 9 lines