Skip to content

L1-035 情人节

Statement

Metadata

  • 作者: 陈越
  • 单位: 浙江大学
  • 代码长度限制: 16 KB
  • 时间限制: 400 ms
  • 内存限制: 64 MB

以上是朋友圈中一奇葩贴:“2月14情人节了,我决定造福大家。第2个赞和第14个赞的,我介绍你俩认识…………咱三吃饭…你俩请…”。现给出此贴下点赞的朋友名单,请你找出那两位要请客的倒霉蛋。

输入格式

输入按照点赞的先后顺序给出不知道多少个点赞的人名,每个人名占一行,为不超过10个英文字母的非空单词,以回车结束。一个英文句点.标志输入的结束,这个符号不算在点赞名单里。

输出格式

根据点赞情况在一行中输出结论:若存在第2个人A和第14个人B,则输出“A and B are inviting you to dinner…”;若只有A没有B,则输出“A is the only one for you…”;若连A都没有,则输出“Momo… No one is for you …”。

输入样例1

GaoXZh
Magi
Einst
Quark
LaoLao
FatMouse
ZhaShen
fantacy
latesum
SenSen
QuanQuan
whatever
whenever
Potaty
hahaha
.

输出样例1

Magi and Potaty are inviting you to dinner...

输入样例2

LaoLao
FatMouse
whoever
.

输出样例2

FatMouse is the only one for you...

输入样例3

LaoLao
.

输出样例3

Momo... No one is for you ...

Solution

#include <ctype.h>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6;

const int INF = 0x3f3f3f3f;
const int maxn = 1e3 + 5;
const int MOD = 1e9 + 7;

int main() {
    string l = "", r = "", s;
    for (int i = 1;; i++) {
        cin >> s;
        if (s == ".")
            break;
        else if (i == 2)
            l = s;
        else if (i == 14)
            r = s;
    }
    if (l != "" && r != "") {
        cout << l;
        printf(" and ");
        cout << r;
        printf(" are inviting you to dinner...\n");
    } else if (l != "") {
        cout << l;
        printf(" is the only one for you...\n");
    } else
        printf("Momo... No one is for you ...\n");
}

Last update: May 4, 2022
Back to top