长春网站建设加q479185700,网站建设的主要功能及定位,视觉vi设计,深圳知名网站设计公司排名CF43A Football 题解题目链接字面描述题面翻译题面描述题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1样例 #2样例输入 #2样例输出 #2代码实现题目
链接
https://www.luogu.com.cn/problem/CF43A
字面描述
题面翻译
题面描述
两只足球队比赛#xff0c;现给你进…
CF43A Football 题解题目链接字面描述题面翻译题面描述题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1样例 #2样例输入 #2样例输出 #2代码实现题目
链接
https://www.luogu.com.cn/problem/CF43A
字面描述
题面翻译
题面描述
两只足球队比赛现给你进球情况问哪支队伍赢了。
第一行一个整数 nnn1≤n≤1001\leq n\leq 1001≤n≤100表示有 nnn 次进球接下来 nnn 行每行一个长度不超过 101010只由大写字母组成的字符串表示一个进球的球队名保证只有两个球队。
输出一个字符串表示胜利球队的球队名不会平局。
题目描述
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn’t find the overall score of the match; however, he got hold of a profound description of the match’s process. On the whole there are $ n $ lines in that description each of which described one goal. Every goal was marked with the name of the team that had scored it. Help Vasya, learn the name of the team that won the finals. It is guaranteed that the match did not end in a tie.
输入格式
The first line contains an integer $ n $ ( $ 1n100 $ ) — the number of lines in the description. Then follow $ n $ lines — for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end in a tie and the description contains no more than two different teams.
输出格式
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
样例 #1
样例输入 #1
1
ABC样例输出 #1
ABC样例 #2
样例输入 #2
5
A
ABA
ABA
A
A样例输出 #2
A代码实现
map的一道基础操作模板题稍后会写map的数据结构介绍
#includebits/stdc.h
using namespace std;int t,cnt;
string a,ans;
mapstring,intmp;
mapstring,int::iterator it;
int main(){cint;while(t--){cina;mp[a];}for(itmp.begin();it!mp.end();it){if(it-second cnt){cntit-second;ansit-first;}}coutansendl;return 0;
}