ZOJ 3610 Yet another story of Rock-paper-scissors

Source: Internet
Author: User

Title Link: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3610


Surface:



Yet another story of Rock-paper-scissors Time limit: 2 Seconds Memory Limit: 65536 KB

akihisa and Hideyoshi were lovers. They were sentenced to death by the FFF inquisition. Ryou, the leader of the FFF Inquisition, promised that the winner of Rock-paper-scissors would is immune from the Punishme NT. Being lovers, Akihisa and Hideyoshi decided to die together with their fists clenched, which indicated rocks in the GA Me. However, at the last moment, Akihisa chose paper and Hideyoshi chose scissors. As a result, Akihisa was punished by the FFF inquisition and Hideyoshi survived alone.

When a boy named b and a girl named g is being punished by the FFF inquisition, they'll play rock-paper-scissor S and the winner would survive. If There is a tie, then neither of they would survive. At first, they promise to choose the same gesture x . But actually, the boy wants-to-win and the girl wants to lose. Of course, neither of them knows that and the other one could change his/her gesture. At the last, who would survive?

Input

There is multiple test cases. The first line of input was an integer T ≈1000 indicating the number of test cases.

Each test case contains three strings-- b g x . All strings consist of letters and their lengths never exceed 20. The gesture x is always one "rock" of, and "paper" "scissors" .

Output

If There is a tie, output "Nobody will survive" . Otherwise, output where is the name of the "y will survive" y winner.

Sample Input
1Akihisa Hideyoshi Rock
Sample Output
Hideyoshi'll survive


Solving:

See through, water problem together, input is a bit strange, refers to two people began to discuss what is out. Because, stone scissors cloth fits together relationship, girls and boys psychological is fixed, so always girls win. Although it is a water problem, but can quickly and accurately cut off, or is very elegant!


Code:

#include <iostream> #include <algorithm> #include <string> #include <iomanip> #include < Cstdio> #include <cstring>using namespace Std;int main () {int n;cin>>n;string bname,gname,s;while (n--) {    cin>>bname>>gname>>s;    cout<<gname<< "would survive\n";    } return 0;}



ZOJ 3610 Yet another story of Rock-paper-scissors

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.