HDU4870: Rating (DP), hdu4870ratingdp

Source: Internet
Author: User
Tags float number

HDU4870: Rating (DP), hdu4870ratingdp
Problem DescriptionA little girl loves programming competition very much. recently, she has found a new kind of programming competition named "TopTopTopCoder ". every user who has registered in "TopTopTopCoder" system will have a rating, and the initial value of rating equals to zero. after the user participates in the contest held by "TopTopTopCoder", her/his rating will be updated depending on her /His rank. supposing that her/his current rating is X, if her/his rank is between on 1-200 after contest, her/his rating will be min (X + 50 ). her/His rating will be max (X-100, 0) otherwise. to reach 1000 points as soon as possible, this little girl registered two accounts. she uses the account with less rating in each contest. the possibility of her rank between on 1-200 is P for every contest . Can you tell her how her account ratings reach 1000 points?
InputThere are several test cases. Each test case is a single line containing a float number P (0.3 <= P <= 1.0). The meaning of P is described above.
OutputYou shoshould output a float number for each test case, indicating the expected count of contest she needs to participate in. This problem is special judged. The relative error less than 1e-5 will be accepted.
Sample Input

1.0000000.814700
 
Sample Output
39.00000082.181160 because each time 50 minutes, it reaches 1000 points, so it can be regarded as 1 point each time, reach 20 points dp [I] indicates I to 20 mathematical expectations so dp [I] = dp [I + 1] * p + dp [I-2] * q + 1; t [I] = dp [I + 1]-dp [I] t [I] = (t [I + 1] * p + t [I-2] * q) so t [I + 1] = (t [I]-t [I-2] * q)/p
#include <stdio.h>int main(){    float p,sum,t[21],q;    int i;    while(~scanf("%f",&p))    {        sum = 0;        q = 1-p;        t[0] = 1/p,t[1] = t[0]/p,t[2] = t[1]/p;        sum = t[0]+t[1]+t[2];        for(i = 3;i<20;i++)        {            t[i] = (t[i-1]-t[i-3]*q)/p;            sum+=t[i];        }        printf("%.6f\n",sum*2-t[19]);    }    return 0;}



What are the types of Dynamic Planning for noip (improving group difficulty? (For example, coordinate DP and backpack DP) What are their classic questions?

Tree-like dp, interval type, line type, backpack, State compression, quadrilateral inequality optimization, etc.
There are many questions in poj classification.

Early speech future: How did Ge Ji plan (DP deluxe edition) Get it

1. You have to have the "initial speech future: Diva plan/initial speech future: Project Diva".
2. Put the package in the iso folder, and keep the file name in English.
3. Open. Go to the menu. Click [renew your subscription ]. Then [Music ]. Click Quanqu. Then, all the way around.
4. Return. Click [please wait until then ]. An archive will be prompted here. Remember to store different files for each song. Do not overwrite.
5. Exit.
6. Enter the "initial speech future: Diva plan/initial speech future: Project Diva".
7. Choose edit mode> try-on editing> select Edit archive> select a song (press the R key to select an mp3 song ). You can see the song.
8. Select a song from the menu. Otherwise, there will be words that are not correct (= hope you can understand this sentence)
9, in fact, is equivalent to a pvpackage ....

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.