Zoj 3634 Bounty Hunter (DP, do not think clearly, need to look back to see _20151027)

Source: Internet
Author: User

M-bounty HunterTime limit:5000MS Memory Limit:65536KB 64bit IO Format:%lld &%llu< /c7> SubmitStatus

Description

Bounty Hunter is a hero who always moves along cities to earn money by his power. One day he decides to cities one by one N

At the beginning, Bounty Hunter have money and X Y points of Attack force. At day 1, he'll goes to City 1, then City 2 at Day 2, City 3 at day 3, ... At the last, he goes to the city at day and N N leaves it on day N+1 . In each city, he can increase the attack force by money and earn some money by accepting a task. iin the city, it costs him-increase one point of ai attack Force. And he can gets * money through finishing the task in the city while was his attack force after his bi yi i yi Increa Sing at City i .

As it ' s known to all this money are the life of Bounty Hunter, he wants to own as much money as he can after leaving city c12/>. Please find the maximal moeny he can get.

Ps1:when Bounty Hunter leaves a city he won ' t come back.

Ps2:bounty Hunter can increases his attack force by any real numbers he wants, if the money is enough. For example, if he had 7 money and the unit price of attack in the city he stays are 2, he can spend 3 money to I Ncrease attack Force by 1.5.

Ps3:after Bounty Hunter finishes the task he'll leave the city at once. It means he can and only can increase him attack force before he finishes the task and gets the the money in the same city.

Input

The first line of the input was three integers N , X , Y , (0≤ N , X Y ≤100000) following is N lines. The-th line has both i real number and ai bi . ( 0≤ bi ≤1,0< ai ≤100000)

Output

Output The maximal money he can get. Both decimal places reserved. We promise that the answer are less than 1E15

Sample Input

1 10 01.0 1.03 13 57.0 1.01.1 0.61.0 0.6

Sample Output

10.0025.64

DP Bitter hand ....
Read a lot of the puzzle ... But it's all a kind ...
Copying other people's answers also does not add a source ...
It seems to be written by myself ... It's boring ...
Transfer equation There's one place you don't want to know ...
is dp_m[i+1]*b[i] This formula .... What do you mean ...?
Mother Egg .... I'll think about it sometime.
1 /*************************************************************************2 > File name:code/zoj/3634.cpp3 > Author:111qqz4 > Email: [Email protected]5 > Created time:2015 October 27 Tuesday 13:46 35 seconds6  ************************************************************************/7 8#include <iostream>9#include <iomanip>Ten#include <cstdio> One#include <algorithm> A#include <cmath> -#include <cstring> -#include <string> the#include <map> -#include <Set> -#include <queue> -#include <vector> +#include <stack> -#include <cctype> +                   A #defineYn hez111qqz at #defineJ1 CUTE111QQZ - #defineMS (A,X) memset (A,x,sizeof (a)) - using namespacestd; - Const intdx4[4]={1,0,0,-1}; - Const intdy4[4]={0,-1,1,0}; -typedefLong LongLL; intypedefDoubleDB; - Const intINF =0x3f3f3f3f; to Const intn=1e5+7; + DoubleA[n],b[n],dp_a[n],dp_m[n]; - intN; the intx, y; * intMain () $ {Panax Notoginseng #ifndef Online_judge -Freopen ("In.txt","R", stdin); the   #endif +  A     while(SCANF (" %d%d%d", &n,&x,&y)! =EOF) the     { +      for(inti =1; I <= N; i++) scanf ("%LF%LF",&a[i],&b[i]); -      $MS (DP_A,0); $MS (Dp_m,0); -Dp_a[n] =B[n]; -Dp_m[n] =max (1.0,1.0/a[n]*B[n]);  the  -      for(inti = n1; I >=1; i--)Wuyi     { theDp_a[i] = dp_m[i+1]*b[i]+dp_a[i+1];//The transfer equation is still not very clear tat is mainly dp_m[i+1]*b[i] this part ... Think again . -Dp_m[i] = max (dp_m[i+1],1.0/a[i]*dp_a[i]); Wu     } -printf"%.2f\n", x*dp_m[1]+y*dp_a[1]); About     } $    -     - #ifndef Online_judge - fclose (stdin); A   #endif +     return 0; the}
View Code

Zoj 3634 Bounty Hunter (DP, not fully aware, need to go back to see _20151027)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.