GetAccepted
TCO19 SRM 740 · 2018-10-19 · by misof
Problem Statement
For this task we have created a simple automated system.
It was supposed to ask you a question by giving you a
"Do you want to get accepted?" "True."
Unluckily for you, a hacker got into our system and modified it by inserting negations into the sentence. Each negation completely changes the meaning of the question to the opposite one, which means that you need to give us the opposite answer.
Write a program that will read the question and answer accordingly. More precisely, your program must return either the string "True." if the question you are given has the same meaning as the one shown above or the string "False." if the question has the opposite meaning.
Notes
- All strings in this problem are case-sensitive. In particular, make sure the strings your program returns have correct uppercase and lowercase letters, as shown in the statement and examples.
Constraints
- question will always have the following form: "Do you " + X + "want to " + Y + "get " + Z + "accepted?", where each of X, Y and Z is the concatenation of zero or more copies of the string "not ".
- question will have at most 1000 characters.
"Do you want to get accepted?" Returns: "True."
This is the original question, you should give the original answer.
"Do you not want to get accepted?" Returns: "False."
This question has the opposite meaning from the original, you should give the opposite answer.
"Do you want to not get accepted?" Returns: "False."
This is another possible negation of the original question.
"Do you want to get not not accepted?" Returns: "True."
Two negations cancel each other out. The meaning of this question is the same as the meaning of the original question, so you should answer "True.".
"Do you not want to not get not not not accepted?" Returns: "False."
Submissions are judged against all 40 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class GetAccepted with a public method string answer(string question) · 40 test cases · 2 s / 256 MB per case