Clarifications

 链接:https://ac.nowcoder.com/acm/contest/624/B
来源:牛客网
 

The university programming contest of HIT@WH is going to start!

 

As the main problem setter, Ramen is going to reply to the requests for clarification during the contest. 

 

The level of the contestants is varied so that they will ask different questions. Some questions are foolish, the most stupid one among them is: Why I got WA on problem X?. Some are critical that may indicate that there is something went wrong, and juries need to investigate.

 

To make different responses for each request is unnecessary and boring, so Ramen has his own rules to answer the contestant. Here are the rules of how he makes a response:

 

- If the request is a statement, he will answer No Response.

- If the request is a stupid question, he will answer 42.

- If the question is not a stupid question and the question has been asked less or equal than five times, he will answer Read the problem statement carefully.

- If the question is not a stupid question and the question has been asked more than five times, he will answer Juries are investigating. Thanks.

 

A statement ends with a period(.) while a question ends with a question mark(?).

The contest is running, but Ramen has some urgent work to do, so he is absent. You know Ramen's rules, can you help him for a while?

输入描述:

The input contains multiple lines.

The first line contains two integers n, q(1 <= n <= 10000, 1 <= q <= 100), indicates the number of requests and the number of stupid questions.

Each of the next q lines contains a distinct stupid question.

Then each of the next n lines contains a request for clarification.

It's guaranteed that the all given strings will only contain Latin letters and spaces, and each line ends with a period or a question mark. The length of each of them will not exceed 100.

输出描述:

Output exactly n lines. The i-th line represents the answer to the i-th request of clarifications.

示例1

输入

复制

10 2
Why I got WA on problem A?
How to solve problem C?
The problems are really good.
Why I got WA on problem A?
Why I got CE?
Why I got CE?
How to solve problem C?
Why I got CE?
Why I got CE?
Why I got CE?
The constraint of E is correct?
Why I got CE?

输出

复制

No Response.
42.
Read the problem statement carefully.
Read the problem statement carefully.
42.
Read the problem statement carefully.
Read the problem statement carefully.
Read the problem statement carefully.
Read the problem statement carefully.
Juries are investigating. Thanks.

备注:

Do not forget to output the dot(.) at the end of each answer.

What does 42 mean? It's the answer to life, the universe, and everything.

You can still ask any question during the contest. It's guaranteed that juries will never answer you 42, seriously.

模拟:用map存一下gets获取一串的按题目模拟即可 

#include<iostream>
#include<cstring>
#include<map>
using namespace std;
char a[10009];
string v[10009];
int main()
{
    int n,q;map<string,int>A;
    scanf("%d%d",&n,&q);getchar();
    for(int i = 0;i<q;++i)
    {
        gets(a);
        int d = strlen(a);
        for(int j = 0;j < d;++j)
        {
            v[i]+=a[j];
        }      
    }
    while(n--)
    {
        gets(a);string s = "";
        int d = strlen(a);
        for(int i = 0;i < d;++i)
        {
            s+=a[i];
        }  
        A[s]++;
         
        if(s[d-1] == '.')
        {
            printf("No Response.\n");continue;
        }
        int flag =0;
        for(int i = 0;i < q;++i)
        {
            if(v[i] == s)
            {
                flag =1;break;
            }
        }
        if(flag)
        {
            printf("42.\n");continue;
        }
        else
        {
            if(A[s] <= 5)
            {
                printf("Read the problem statement carefully.\n");
            }
            else{
            printf("Juries are investigating. Thanks.\n");
            }
        }
     
    }
    return 0;
 }

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

-lyslyslys

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值