热身赛
A.三玖天下第一
题目链接: https://hpuoj.com/contest/18/problem/A/
思路: 很水的一道题, $map$ 统计出现次数最多的数字,判断一下输出就行了.
代码:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
map<char,int>M;
cin>>s;
int ans=0;
for(int i=0;i<s.length();i++)
M[s[i]]++;
for(int i='0';i<='9';i++)
if(M[i]>M[ans])ans=i;
if(ans=='0')cout<<"Five equal parts."<<endl;
else if(ans=='1')cout<<"One flower gathers people."<<endl;
else if(ans=='2')cout<<"The second is very color."<<endl;
else if(ans=='3')cout<<"San Jiu tian xia di yi!"<<endl;
else if(ans=='4')cout<<"Four leaves kawaii."<<endl;
else cout<<"May daughter."<<endl;
return 0;
}