当前位置:网站首页>Codeforces Round #614 (Div. 2) B. JOE is on TV!
Codeforces Round #614 (Div. 2) B. JOE is on TV!
2022-07-28 10:32:00 【Xiaoliu xuezha】
time limit per test: 1 second
memory limit per test: 256 megabytes
inputstandard input
outputstandard output
3R2 - Standby for Action
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 t/s 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≤10^5),
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 1/2+1/1=1.5 dollars.
#include <iostream>
using namespace std;
int main()
{
int n;
double sum=0;
cin>>n;
for(int i=n;i>0;i--)
{
sum+=(1.0/i);
}
printf("%.12lf\n",sum);
return 0;
}
边栏推荐
- 5、动态规划---斐波那契数列
- Record a parent-child project in idea, modify the name of project and module, and test it personally!
- pt-kill 查询中包含中文字符 导致工具失效的排查
- ACM寒假集训#6
- 问题总结档案
- India plans to ban China Telecom equipment! Can we really do without Huawei and ZTE?
- Codeforces Round #614 (Div. 2) B. JOE is on TV!
- 配置树莓派,过程和遇到问题
- 【微信小程序】项目实战—抽签应用
- Codeforces Round #614 (Div. 2) A. ConneR and the A.R.C. Markland-N
猜你喜欢

IDEA打包jar包及运行jar包命令

Match file names from file paths using regular expressions

SQL Server 2016 学习记录 --- 数据定义

15. Judge whether the target value exists in the two-dimensional array

gcc: error trying to exec 'as': execvp: No such file or directory

14、双指针——盛最多水的容器

SQL Server 2016 学习记录 --- 集合查询

django-celery-redis异步发邮件

SQL Server 2016 学习记录 --- 数据更新

逆元&组合数&快速幂
随机推荐
Qt生成.exe文件 并 在无Qt环境下运行(Enigma Virtual Box进行绿色可执行软件封装)图文教程
ZTE: 5nm 5g base station chip is being introduced!
5. Dynamic programming -- Fibonacci series
Xu Ziyang, President of ZTE: 5nm chip will be launched in 2021
(1)机器学习概念总结
Netease written test No. 2 -- typical application of European distance
8. Numbers that appear more than half of the time in the array
SQL Server 2016 学习记录 --- 集合查询
20200229训练赛 L2 - 2 树种统计 (25分)
C语言 二级指针详解及示例代码
Typora使用教程
利用正则表达式从文件路径中匹配文件名
20200217训练赛 L1 - 7 2019来了 (20分)
ACM winter vacation training 6
CentOS7下安装mysql5.7
用两个栈实现一个队列【C语言】
a different object with the same identifier value was already associated with the session
6、双指针——递增数组两数之和与目标数相等
管道、管程、管态的区别
Differences among pipes, pipe passes and pipe States