zoukankan      html  css  js  c++  java
  • uva 6757 Cup of Cowards(中途相遇法,貌似)

    uva 6757 Cup of Cowards
    Cup of Cowards (CoC) is a role playing game that has 5 different characters (Mage, Tank, Fighter,
    Assassin and Marksman). A team consists of 5 players (one from each kind) and the goal is to kill a
    monster with L life points. The monster dies if the total damage it gets is at least L. Each character
    has a certain number of allowed hits, each hit has a certain damage and a certain cost (the cost and
    damage might be different for each character). The team wants to kill the monster using the minimum
    cost so they can perform better in later missions. They want your help to find the minimum cost they
    will pay to kill the monster and the damage they should incur on it.
    Input
    Your program will be tested on one or more test cases. The first line of the input will be a single
    integer T, the number of test cases (1 ≤ T ≤ 100). Followed by the test cases, the first line of each
    test case contains 1 integer L (0 ≤ L ≤ 1012) representing the life points of the monster. Followed by
    5 lines, each one contains 3 integers separated by a single space H D C representing the maximum
    number of hits, the damage by each hit and the cost of each hit by one of the characters, respectively
    (0 ≤ H ≤ 1, 000), (0 ≤ D, C ≤ 109
    ) and the sum of the maximum number of hits for all characters will
    not be more than 1,000.
    Output
    For each test case, print a single line which contains 2 space separated integers, the first is the minimum
    cost for the hits used to kill the monster and the second is the damage incurred upon the monster. If
    there is more than one way to kill the monster using the same minimum cost, select the one with the
    least damage and if there is no way to kill the monster print ‘We are doomed!!’ (without the quotes).
    Sample Input
    2
    33
    2 3 4
    3 1 2
    4 3 2
    1 7 1
    3 4 2
    51
    3 3 1
    4 3 2
    2 3 3
    3 1 4
    5 2 3
    Sample Output
    19 33
    We are doomed!!

    貌似中途相遇法,时间2500ms

    view code
  • 相关阅读:
    设计模式之美学习-接口隔离原则(七)
    设计模式之美学习-里式替换原则(六)
    设计模式之美学习-开闭原则(五)
    设计模式之美学习-设计原则之单一职责(四)
    设计模式之美学习-如何进行面向对象设计(三)
    ffmpeg 从内存中读取数据(或将数据输出到内存)
    CImage 对话框初始化时候显示透明 PNG
    RTMPdump(libRTMP) 源代码分析 9: 接收消息(Message)(接收视音频数据)
    RTMPdump(libRTMP) 源代码分析 8: 发送消息(Message)
    RTMPdump(libRTMP) 源代码分析 7: 建立一个流媒体连接 (NetStream部分 2)
  • 原文地址:https://www.cnblogs.com/zyx1314/p/3928077.html
Copyright © 2011-2022 走看看