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.
思路:一个比较简单的数学题吧,每次走一个人,最后的结果是最大的。
代码如下:

#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)/~

JOE is on TV! CodeForces - 1293B(数学)相关推荐

  1. codeforces数学1600day6[CodeForces - 1029C多区间交+枚举,CodeForces 992C[数学公式推导],CodeForces 992B[质因数分解+暴力枚举]]

    A - Maximal Intersection CodeForces - 1029C 题目大意:就是给你n个区间,这n个区间有公共的区间长度为x,现在叫你从这n个区间中删掉一个使得x最大化. 解题思 ...

  2. Codeforces 300E(数学)

    题意:给定k个数字,求最小的正整数n,使得"n的阶乘"是"这k个数字的阶乘的积"的倍数.1<=k<=1e6,数字ai满足1<=ai<=1 ...

  3. 18行代码AC_Wet Shark and Bishops CodeForces - 621B(数学推导+映射)

    励志用少的代码做高效表达 Problem describe Today, Wet Shark is given n bishops on a 1000 by 1000 grid. Both rows ...

  4. CodeForces 382B 数学推导

    这个题目题意简单,但是TLE得哭哭的... 输入 a b w x c五个数,最终要使得c<=a, 每一秒可以进行一个操作,如果b>=x,则 b=b-x,同时 c--;如果b<x,则a ...

  5. E - Olympic Medal CodeForces - 215B(数学 思维)

    The World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a r ...

  6. Codeforces 405D 数学问题

    真是脑残...擦 具体题解在这里 http://www.cnblogs.com/windysai/p/3619222.html 原本我为了防止两个数冲突,设置了好多判断,结果发现,如果两个数冲突,另外 ...

  7. Sasha and a Very Easy Test CodeForces - 1109E (数学,线段树)

    大意: 给定n元素序列, q个操作: (1)区间乘 (2)单点除(保证整除) (3)区间求和对m取模 要求回答所有操作(3)的结果 主要是除法难办, 假设单点除$x$, $x$中与$m$互素的素因子可 ...

  8. 一位法国女数学史家与中国两代同行的40年交往

    原文标题:<一位外国学者眼中的中国数学史学会40年--为庆祝中国数学史学会成立40周年而作> 来华数月之后,我就初次听闻中国数学史学会之名.如今四十年过去,我为成为这个团体的一员而感到自豪 ...

  9. Codeforces Round 546 (Div. 2)

    layout: post title: Codeforces Round 546 (Div. 2) author: "luowentaoaa" catalog: true tags ...

最新文章

  1. 使用R实现一个简单的连续系统模拟
  2. python游戏编程入门 免费-Python游戏编程入门4
  3. Spring cloud zuul跨域(一)
  4. LUA 运行期间不独占线程的递归,通过回调实现
  5. 直播预告 | AAAI 2022论文解读:融入知识图谱的分子对比学习
  6. Shell 编程基础1 2019-7-6
  7. Linux tcpdump命令用法详解
  8. (转)Windows系统、Linux系统 和 Mac OS操作系统 历史由来 与 区别?
  9. iphone启动页面,Default.png .
  10. Keepalived 无法自动转换主备角色,请关注 iptables 防火墙配置
  11. 2021-06-28获取,更新,删除DOM节点
  12. 英语简历计算机能力描述,简历计算机水平描述
  13. 南京大学行业求职研究报告——投资银行篇
  14. 极简之SVN使用,入职必备
  15. 图解在EXCEL中,通过身份证自动获得出生日期和性别。
  16. 只有懦夫才会畏惧选择!
  17. 《一周搞定模电》—功率放大器
  18. 小米2020校招软件开发工程师笔试题二
  19. DirectX、Direct3D、OpenGL的区别(DX、D3D、OpenGL)
  20. Android开发使用SurfaceView和Mediaplayer播放网络视频(功能齐全)

热门文章

  1. IOS之Label画一条删除线
  2. 桌面消息提醒_对win7的支持已近尾声,如何关闭不断弹出的提醒通知
  3. Git命令,合并分支到master,并提交远程仓库,将本地分支推送到远程仓库
  4. 关于vscode插件autoprefixer 3.0无法使用的问题
  5. linux mysql设置数据库utf_设置mysql数据库 utf8
  6. Android开发之购物车加减按钮(附加源码)
  7. 通过adb命令查看当前activity(更新版)
  8. mysql不被其他ip访问_mysql数据库无法被其他ip访问的解决方法
  9. 西部数据硬盘支持linux,西部数据开发新的Linux文件系统“Zonefs” 支持在分区块设备上运行...
  10. mysql数据库局限性_Mysql分区表局限性总结