zoukankan      html  css  js  c++  java
  • 模拟 H

    H - Penalties Kick
    Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu
    Submit Status

    Description

    Football is an excellent game, but sometimes it is cruel. As you know, two football teams may have a tie after regular time and even addition time, but we have to judge who is the winner, so penalty comes.

    Here are the rules taken from FIFA:

    1. If, before both teams have taken five kicks, one has scored more goals than the other could score, even if it were to complete its five kicks, no more kicks are taken;

    2. If, after both teams have taken five kicks, both have scored the same number of goals, or have not scored any goals, kicks continue to be taken in the same order until one team has scored a goal more than the other from the same number of kicks;

    3. Each kick is taken by a different player and all eligible players must take a kick before any player can take a second kick;

    4. After every player has taken a kick, they take the second kick in the same order as the first kick, and the same with third, fourth ... kick.

    Now we have some kick results of the game, but unfortunately Doraemon wrote some additional results on the paper of kick results, which make the results become a 22 * 3 matrix. Now you have to judge who is the winner and what is the score.

    Input

    The first line gives the number of test cases T, (1 ≤ T ≤ 1000), after the first line followed T cases. In each case, the first 11 lines give the kick results of the home team, in each line, there are 3 words(each word is either "yes" or "no") which indicates the result of the player's first kick, second kick and third kick(of course, the game would end before take three turns, but Doraemon always makes things bad). The next 11 lines give the kick result of the away team. Home team takes the kick first, and player kicks in the given order.

    Output

    For each case, output contains three lines. The first line is "Match #:", where "#" is the case number. The second line is the "Winner:winner_name", (winner_name is either "home" or "away"). The third line is the final score "Score: home_score:away_score".

    Sample Input

    1
    yes yes yes
    yes yes yes
    yes no no
    yes no no
    yes no no
    no no no
    no no no
    no no no
    no no no
    no no no
    no no no
    yes no no
    no no no
    no no no
    yes no no
    yes no no
    yes yes yes
    yes yes yes
    yes yes yes
    yes yes yes
    yes yes yes
    yes yes yes
    

    Sample Output

    Match 1:
    Winner: home
    Score: 4:1
    

    Hint

    Doraemon suggests that you should use scanf to read data.

  • 相关阅读:
    剑指 Offer 53
    Visual Studio Ultimate 2013
    手把手教你如何把java代码,打包成jar文件以及转换为exe可执行文件
    DirectX的Vertex Buffer顶点缓冲的理解和应用 Shader必知必会
    Qt5.2中的android环境搭建
    JavaScript的基础学习篇
    九月十月百度,迅雷,华为,阿里巴巴最新校招笔试面试三十题(10.18)
    十月下旬腾讯,网易游戏,百度迅雷校园招聘笔试题集锦(第271-330题)
    九月十月百度人搜,阿里巴巴,腾讯华为笔试面试八十题(第331-410题)
    十月上旬百度,阿里巴巴,迅雷搜狗最新面试七十题(第201-270题)
  • 原文地址:https://www.cnblogs.com/DreamHighWithMe/p/3415719.html
Copyright © 2011-2022 走看看