比赛 |
NOIP2017普及组模拟赛Mike |
评测结果 |
AAAAA |
题目名称 |
zht |
最终得分 |
100 |
用户昵称 |
路人甲 |
运行时间 |
0.003 s |
代码语言 |
C++ |
内存使用 |
1.46 MiB |
提交时间 |
2017-09-29 21:31:31 |
显示代码纯文本
- #include <cstdio>
- #include <iostream>
- #include <map>
- #include <string>
- #include <cstring>
- #include <algorithm>
- using namespace std;
- char s[1000];
- string a,b,ans1="",ans2="";
- int ansm=0;
- map<string,int> q;
- int tt[100010];
- string fa[100010],to[100010];
- int e=0;
- int main(){
- freopen("zht1.in","r",stdin);
- freopen("zht1.out","w",stdout);
- while (gets(s)&&s[0]!='/0'){
- int i=0;
- a="";
- b="";
- for (;i<strlen(s);++i){
- if (s[i]==':') break;
- a=a+s[i];
- }
- for (++i;i<strlen(s);++i){
- b=b+s[i];
- }
- if (q[b]==0) {
- q[b]=++e;
- tt[e]=1;
- fa[e]=a;
- to[e]=b;
- }
- else ++tt[q[b]];
- }
- /*for (map<string,pair<int,string> >::iterator i=q.begin();i!=q.end();++i){
- if (i->second.first>ansm){
- ansm=i->second.first;
- ans1=i->second.second;
- ans2=i->first;
- }
- }*/
- for (int i=1;i<=e;++i){
- if (tt[i]>ansm){
- ansm=tt[i];
- ans1=fa[i];
- ans2=to[i];
- }
- }
- cout<<ans1<<endl<<ans2;
- return 0;
- }
-