日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

JOE is on TV! CodeForces - 1293B(数学)

發(fā)布時(shí)間:2023/12/15 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JOE is on TV! CodeForces - 1293B(数学) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Our dear Cafe’s owner, JOE Miller, will soon take part in a new game TV-show “1 vs. n”!

The game goes in rounds, where in each round the host asks JOE and his opponents a common question. All participants failing to answer are eliminated. The show ends when only JOE remains (we assume that JOE never answers a question wrong!).

For each question JOE answers, if there are s (s>0) opponents remaining and t (0≤t≤s) of them make a mistake on it, JOE receives ts dollars, and consequently there will be s?t opponents left for the next question.

JOE wonders what is the maximum possible reward he can receive in the best possible scenario. Yet he has little time before show starts, so can you help him answering it instead?

Input
The first and single line contains a single integer n (1≤n≤105), denoting the number of JOE’s opponents in the show.

Output
Print a number denoting the maximum prize (in dollars) JOE could have.

Your answer will be considered correct if it’s absolute or relative error won’t exceed 10?4. In other words, if your answer is a and the jury answer is b, then it must hold that |a?b|max(1,b)≤10?4.

Examples
Input
1
Output
1.000000000000
Input
2
Output
1.500000000000
Note
In the second example, the best scenario would be: one contestant fails at the first question, the other fails at the next one. The total reward will be 12+11=1.5 dollars.
思路:一個(gè)比較簡單的數(shù)學(xué)題吧,每次走一個(gè)人,最后的結(jié)果是最大的。
代碼如下:

#include<bits/stdc++.h> #define ll long long using namespace std;int n;int main() {while(~scanf("%d",&n)){double ans=0.0;for(int i=1;i<=n;i++) ans+=(double)(1.0/(i*1.0));printf("%.12lf\n",ans);}return 0; }

努力加油a啊,(o)/~

總結(jié)

以上是生活随笔為你收集整理的JOE is on TV! CodeForces - 1293B(数学)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。