哈工業(威海)第九屆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.

#include<bits/stdc++.h>
#define clr(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
int main()
{
    string s;
    set<string>str_set;
    map<string,int>map_st;
    int n,m;
    cin>>n>>m;
    getchar();
    while(m--)
	{
        getline(cin,s);
        str_set.insert(s);
    }
    while(n--)
	{
        getline(cin,s);
        map_st[s]++;
        int t=s.size();
        if(s[t-1]!='?')
			cout<<"No Response."<<endl;
        else if(str_set.find(s)!=str_set.end())
			cout<<"42."<<endl;
        else if(map_st[s]<=5)
			cout<<"Read the problem statement carefully."<<endl;
        else 
			cout<<"Juries are investigating. Thanks."<<endl;
    }
    return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章