[ACM_水题] Yet Another Story of Rock-paper-scissors [超水 剪刀石头布]
2014-03-16 16:57
447 查看
DescriptionAkihisa 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 be immune from the punishment. Being lovers, Akihisa and Hideyoshi decided to die together with their fists clenched, which indicated rocks in the game. 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 are being punished by the FFF Inquisition, they will play Rock-paper-scissors and the winner will survive. If there is a tie, then neither of they will 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 the other one may change his/her gesture. At last, who will survive?InputThere are multiple test cases. The first line of input is an integer T ≈ 1000 indicating the number of test cases.Each test case contains three strings -- bgx. All strings consist of letters and their lengths never exceed 20. The gesture x is always one of
"rock",
"paper"and
"scissors".OutputIf there is a tie, output
"Nobody will survive". Otherwise, output
"y will survive"where y is the name of the winner.Sample Input
1 Akihisa Hideyoshi rockSample Output
Hideyoshi will survive 题目大意:T种情况,A,B两人商量好同时出剪刀石头或布,结果A想赢,B想输,输出最终谁赢。 解题思路:B赢
#include<iostream> #include<string.h> #include<cstring> #include<string> using namespace std; int main(){ int T;cin>>T; while(T--){ string str1,str2,str3; cin>>str1>>str2>>str3; cout<<str2<<" will survive\n"; }return 0; }
相关文章推荐
- HDU -- 4496
- Android 网络开发
- 计算器代码的分析
- Struts2_12_访问WEB元素_1
- 矩阵,图片旋转,缩放,平移,
- php绑定客户端mac地址的代码
- 事务
- 详解AlertDialog
- Struts2_11_简单数据验证
- 马化腾眼中移动互联网的10个关键点
- Exception in thread "main" java.lang.StackOverflowError
- Struts2_10_Struts2_2.1.6版本的中文问题
- 各种基本算法实现小结(四)—— 图及其遍历
- Oracle Case when…then else end函数
- Hibernate实战_笔记24(主键生成策略、类映射选项)
- Java 操作 properties 文件
- android中的context
- Struts2_9_用ModelDriven接收参数
- Win7下用VMware 8安装Ubuntu 12.04详细过程图解(学习教程之二)
- HTC G13 刷机时出现no image or wrong image问题解决办法