

Time Limit: 3 sec / Memory Limit: 1024 MB
配点 : 点
問題文
あなたは 個のコンテストに参加します。コンテストが開催される順にコンテスト , コンテスト , コンテスト と呼びます。
各コンテストに参加すると、コンテストごとに パフォーマンス という値が与えられます。コンテスト で与えられるパフォーマンスを とします。
また、あなたは レーティング という値を持っています。レーティングはコンテストでのパフォーマンスによって変化する値です。コンテストに参加する前のレーティングの値は で、コンテスト に出た後のレーティングの値は に変化します。
ただし、あなたのレーティングが一度 以上 になると、それ以降はコンテストに参加してもレーティングは変動しなくなります。
あなたはコンテストに出る前に、それぞれのコンテストで得られるパフォーマンスを予測することにしました。はじめ、コンテスト のパフォーマンスの予測値を とします。クエリが 個与えられるので入力される順にすべて処理してください。
各クエリでは 2 個の整数 が与えられます。あなたは、まずコンテスト のパフォーマンスの予測値を に変更します。(この変更は永続的です。) そして、あなたが 個のコンテスト全てで現在の予測値通りのパフォーマンスを得られた場合の、全てのコンテストに参加した後のレーティングの値を答えてください。
制約
- 入力される値はすべて整数
入力
入力は以下の形式で標準入力から与えられる。ただし、 は 番目のクエリで与えられる を意味する。
出力
行出力せよ。 行目には 番目のクエリに対する答えを出力せよ。
なお、真の値との絶対誤差または相対誤差が 以下であれば正解として扱われる。
入力例 1Copy
5 6 7 5 1 9 3 8 4 9 2 10 1 0 3 0 3 30 5 100 1 100
出力例 1Copy
6.000000000000000 7.500000000000000 6.333333333333333 5.400000000000000 13.333333333333334 13.333333333333334 100.000000000000000
はじめ、 です。
1 番目のクエリによって が に変更されて となります。
このとき、コンテスト でパフォーマンス を取った場合のあなたのレーティングの推移は次の通りです。
- はじめ、レーティングは です。
- コンテスト が終了した時点でレーティングは に変化します。
- コンテスト が終了した時点でレーティングは に変化します。
- コンテスト が終了した時点でレーティングは に変化します。
- コンテスト が終了した時点でレーティングは に変化します。
- 以降、レーティングの値は変化しません。なぜならば、 番目のコンテストが終了した時点でレーティングが 以上の値になっているからです。
よって、全てのコンテストが終了した時点でのレーティングは なので、1 行目にはこれを出力します。
Score : points
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 1Copy
5 6 7 5 1 9 3 8 4 9 2 10 1 0 3 0 3 30 5 100 1 100
Sample Output 1Copy
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.