• zjuoj 3610 Yet Another Story of Rock-paper-scissors


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

    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 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?

    Input

    There 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 -- b g x. All strings consist of letters and their lengths never exceed 20. The gesture x is always one of "rock""paper" and "scissors".

    Output

    If 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 rock
    

    Sample Output

    Hideyoshi will survive
    

    Author: WU, Zejun
    Contest: The 9th Zhejiang Provincial Collegiate Programming Contest

    分析:

    题目输出获胜者的名字即可。分析题目发现无论实现约定什么,女子都会赢,所以直接输出第二个人赢即可。

    AC代码:

     1 #include<cstdio>
     2 #include<algorithm>
     3 #include<cstring>
     4 #include<queue>
     5 #include<iostream>
     6 #include<stack>
     7 #include<map>
     8 #include<string>
     9 using namespace std;
    10 char name1[50], name2[50], type1[50];
    11 int main(){
    12     int n;
    13     scanf("%d", &n);
    14     while(n--){
    15         scanf("%s%s%s", name1, name2, type1);
    16         printf("%s will survive
    ", name2);
    17     }
    18     return 0;
    19 }
    View Code
  • 相关阅读:
    对象的引用
    查询各个商品分类中各有多少商品的SQL语句
    将TP引擎改为smarty引擎
    图片预加载
    js中接口的声明与实现
    判断对象是否是某个类的实例
    判断变量是否为json对象
    Python 爬取淘宝商品数据挖掘分析实战
    Python 爬取淘宝商品数据挖掘分析实战
    扫盲丨关于区块链你需要了解的所有概念
  • 原文地址:https://www.cnblogs.com/jeff-wgc/p/4472226.html
Copyright © 2020-2023  润新知