//传送门:https://www.patest.cn/contests/gplt/L1-035
#include <queue>
#include <functional>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <assert.h>
using namespace std;
/*题意:
用 map<string,int> 记录这个人名是否出现过,
用 cot 记录出现不同人名的个数,
用 string ans1,ans2 分别记录第2、14个出现的人名。
*/
#define N 1005
map<string,int>mp;
int main()
{
string s;
string ans1,ans2;
int cot = 0;
while(cin>>s){
if(s==".") break;
if(mp[s]) continue; //已经出现跳过
cot++;
if(cot==2) ans1 = s;
if(cot==14) ans2 = s;
mp[s]++;
}
if(cot<2) cout<<"Momo... No one is for you ...";
else if(cot<14) cout<<ans1<<" is the only one for you...";
else cout<<ans1<<" and "<<ans2<<" are inviting you to dinner...";
return 0;
}
PAT-练习集-L1-035. 情人节
最新推荐文章于 2023-01-04 11:37:23 发布