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,1000). 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 many contests she needs to participate in to make one of 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 should 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因為每次50分,到達1000分,所以可以看做每次1分,到達20分dp[i]表示i到20的數學期望那麼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)所以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;}
noip(提高組難度)動態規劃有哪幾種類型?(如:座標DP、背包DP等) 各有什經典題目?
樹狀dp,區間型,線型,背包,還有就是狀態壓縮,四邊形不等式最佳化等。
poj分類上有很多題目。
初音未來:歌姬計劃(DP豪華版)怎弄
1,你得有《初音未來:Diva計劃 / 初音未來:Project Diva》。
2。把 包 放到iso檔案夾,檔案名稱保持英文。
3,開啟。進入菜單。點【インストール】。然後【樂曲データ】。點全曲。然後就一路はいはいはい。
4,返回。點【エデイツトデータ】。這裡會提示存檔。切記每一首歌存不同的檔。不要覆蓋。
5,退出。
6,進入《初音未來:Diva計劃 / 初音未來:Project Diva》。
7,進入編輯模式 > 試玩編輯 > 選編輯存檔 > 選歌曲(按R鍵選擇mp3歌曲)。就可以看到歌了。
8,讀哪首歌的檔,就在菜單選哪首歌。不然就會出現詞不對口型了(= =希望這句話大家看的明白)
9,其實就相當於一個pv包。。。。