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