#abc292h. Ex - Rating Estimator
Ex - Rating Estimator
Score : points
问题描述
你将参加从 到 按时间顺序编号的共 场比赛。
在每场比赛中,参与者都会得到一个称为表现值的成绩。设第 场比赛的表现值为 。
此外,你还有一个名为评分的数值,它会根据你在各场比赛中的表现而变化。初始评分为 ,而在完成第 场比赛后的评分为 。
然而,一旦你的评分达到 或超过 ,后续的比赛将不会影响你的评分。
在比赛开始前,你决定预估自己在每场比赛中的表现。设 为你对第 场比赛表现的初始预估值。按顺序处理 个查询请求。
对于每个查询,你会得到两个整数 和 。首先,将你对第 场比赛表现的预估值改为 。(此更改是持久的。)然后,假设你在所有 场比赛中均达到了预估的表现,请输出比赛结束后你的最终评分。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You will participate in contests, numbered to in chronological order.
A participant in each contest will be given a value called performance for that contest. Let be the performance for contest .
Additionally, you have a value called rating, which changes according to the performances in contests. The initial rating is , and the rating after contest is .
However, once your rating is or higher, later contests will not affect your rating.
Before the contests, you have decided to estimate your performance in each contest. Let be the initial estimate of your performance in contest . Process queries in the order they are given.
In each query, you are given two integers and . First, change the estimate of your performance in contest to . (This change is persistent.) Then, assuming that you get the estimated performances in all contests, print your final rating after the contests.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format, where and are the and for the -th query:
Output
Print lines. The -th line should contain the answer to the -th query.
Your output is considered correct if the absolute or relative error from the true answer is at most .
Sample Input 1
5 6 7
5 1 9 3 8
4 9
2 10
1 0
3 0
3 30
5 100
1 100
Sample Output 1
6.000000000000000
7.500000000000000
6.333333333333333
5.400000000000000
13.333333333333334
13.333333333333334
100.000000000000000
Initially, .
The first query changes to , making .
Here, assuming that your performance in contest is , your rating will change as follows.
- Initially, your rating is .
- After contest , your rating will be .
- After contest , your rating will be .
- After contest , your rating will be .
- After contest , your rating will be .
- Your rating will no longer change, because your rating after contest is not less than .
Thus, your final rating after the contests is , which should be printed in the first line.
update @ 2024/3/10 12:11:47