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
  • 相关阅读:
    linux信号
    APM浅析
    Jackson高并发情况下,产生阻塞
    [转]slf4j 与log4j 日志管理
    2015-09-27 git学习
    MySQL学习笔记-锁相关话题
    MySQL学习笔记-MySQL数据库优化实践[转]
    MySQL学习笔记-事务相关话题
    几个关于网站架构和性能的问题(我在知乎上的问答)
    MySQL学习笔记-数据库文件
  • 原文地址:https://www.cnblogs.com/zyx1314/p/3928077.html
Copyright © 2011-2022 走看看