22685_RPG

2022-5-16 18:22| 发布者: Hocassian| 查看: 23| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506852979199-Problem List-采集的数据-后羿采集器.html

Pro.ID

22685

Title

RPG

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22685

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1500/500 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    To complete a role-playing game (RPG), you must send your character through N quests. The quests may be passed in any order, but after starting a quest you can’t drop it and switch to another. If your character fails even one quest you fail the whole game. The probability of succeeding in a quest depends on the experience points (XP) of your character at the beginning of the quest, and is determined by the formula


    whereai and bi are parameters of the i-th quest.

    After successful completion of the i-th quest, your character obtains Si experience points. Initially, it/he/she has D points. 

    Write a program to determine such an order of the quests that the probability of completing the whole game successfully is the highest possible.

    输入

    The first line of the file contains the values N ( 1 <= <= 10 ) and D. Each of the following N lines describes one quest, containing the values ai, bi, Si. The values D, ai, bi, Si ( 1 <= i <= ) are all integers in the range from 0 to 1000 and ai<bi ( 1 <= i <= ). Adjacent values on the same line are separated by one or more spaces.

    输出

    Description

    To complete a role-playing game (RPG), you must send your character through N quests. The quests may be passed in any order, but after starting a quest you can’t drop it and switch to another. If your character fails even one quest you fail the whole game. The probability of succeeding in a quest depends on the experience points (XP) of your character at the beginning of the quest, and is determined by the formula


    whereai and bi are parameters of the i-th quest.

    After successful completion of the i-th quest, your character obtains Si experience points. Initially, it/he/she has D points. 

    Write a program to determine such an order of the quests that the probability of completing the whole game successfully is the highest possible.
    Input
    The first line of the file contains the values N ( 1 <= <= 10 ) and D. Each of the following N lines describes one quest, containing the values ai, bi, Si. The values D, ai, bi, Si ( 1 <= i <= ) are all integers in the range from 0 to 1000 and ai<bi ( 1 <= i <= ). Adjacent values on the same line are separated by one or more spaces.
    Output
    The first line must contain the highest possible probability with the precision of 0.001. The second line must contain the order of quests that ensures this probability. If there are several orders with the same probability, output any one of them.
    Sample Input
    3 300
    350 380 100
    100 200 100
    440 450 100
    Sample Output
    1.000
    2 1 3
    Hint
    Special Judge
    Source

    样例输入

    3 300
    350 380 100
    100 200 100
    440 450 100

    样例输出

    1.000
    2 1 3

    提示

    Special Judge


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部