CF1293B.JOE is on TV!

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

3R2 - Standby for Action

Our dear Cafe's owner, JOE Miller, will soon take part in a new game TV-show "1 vs. nn"!

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 ss (s>0s \gt 0) opponents remaining and tt (0≤t≤s0 \le t \le s) of them make a mistake on it, JOE receives ts\displaystyle\frac{t}{s} dollars, and consequently there will be s−ts - 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?

3R2 - 待命行动

我们亲爱的咖啡馆老板乔·米勒(JOE Miller)即将参加一档全新的电视游戏节目——《1 对 nn》!

该节目以回合制进行:每轮中,主持人向乔及其所有对手提出同一个问题。所有未能答对的参与者将被淘汰。当仅剩乔一人时,节目结束(我们假设乔永远不会答错!)。

对于乔所回答的每个问题:若当前尚有 ss(s>0s \gt 0)名对手,则其中恰好有 tt(0≤t≤s0 \le t \le s)人答错,此时乔将获得 ts\displaystyle\frac{t}{s} 美元奖励;随后,下一轮将剩下 s−ts - t 名对手。

乔想知道:在最优情形下,他所能获得的最大总奖金是多少?然而节目即将开始,他时间紧迫——你能帮他算出这个最大值吗?

输入格式

The first and single line contains a single integer nn (1≤n≤1051 \le n \le 10^5), denoting the number of JOE's opponents in the show.

第一行且唯一一行包含一个整数 nn(1≤n≤1051 \le n \le 10^5),表示 JOE 在该节目中的对手数量。

输出格式

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−410^{-4}. In other words, if your answer is aa and the jury answer is bb, then it must hold that ∣a−b∣max(1,b)≤10−4\frac{|a - b|}{max(1, b)} \le 10^{-4}.

输出一个数字,表示 JOE 可能获得的最高奖金(单位:美元)。

若你的答案绝对误差或相对误差不超过 10−410^{-4},则视为正确。换言之,若你的答案为 aa,而评测组的答案为 bb,则必须满足 ∣a−b∣max⁡(1,b)≤10−4\frac{|a - b|}{\max(1, b)} \le 10^{-4}。

输入输出样例

  • 输入#1

    1

    输出#1

    1.000000000000
  • 输入#2

    2

    输出#2

    1.500000000000

说明/提示

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\displaystyle \frac{1}{2} + \frac{1}{1} = 1.5 dollars.

在第二个例子中,最优情况是:一名参赛者在第一题失败,另一名参赛者在下一题失败。总奖金为 12+11=1.5\displaystyle \frac{1}{2} + \frac{1}{1} = 1.5 美元。

输入解题思路,AI测评打分。不知道怎么写?

首页