Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: RPG
Description To complete a role-playing game (RPG), you must send your character through b are parameters of the _{i}i-th quest.After successful completion of the i-th quest, your character obtains S experience points. Initially, it/he/she has _{i}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 input contains the values b, _{i}S. The values _{i}D, a, _{i}b, _{i}S (1≤_{i}i≤N) are all integers in the range from 0 to 1000 and a<_{i}b (1≤_{i}i≤N). Adjacent values on the same line are separated by one or more spaces.Output The first line of the output 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 Source Northeastern Europe 2002, Western Subregion |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator