#C. C - Doukasen

    传统题 1000ms 256MiB

C - Doukasen

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

C - Doukasen

Score : $300$ points

Problem Statement

We have $N$ fuses connected in series. The $i$-th fuse from the left has a length of $A_i$ centimeters and burns at a constant speed of $B_i$ centimeters per second.

Consider igniting this object from left and right ends simultaneously. Find the distance between the position where the two flames will meet and the left end of the object.

Constraints

  • $1 \leq N \leq 10^5$
  • $1 \leq A_i,B_i \leq 1000$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 B1B_1

A2A_2 B2B_2

\vdots

ANA_N BNB_N

Output

Print the distance between the position where the two flames will meet and the left end of the object, in centimeters (print just the number).

Your output will be considered correct when its absolute or relative error from our answer is at most $10^{-5}$.


3
1 1
2 1
3 1
3.000000000000000

The two flames will meet at $3$ centimeters from the left end of the object.


3
1 3
2 2
3 1
3.833333333333333

5
3 9
1 2
4 6
1 5
5 3
8.916666666666668

2025寒假ATC码力训练营第二次练习

未参加
状态
已结束
规则
IOI
题目
6
开始于
2025-1-19 13:00
结束于
2025-1-19 14:30
持续时间
1.5 小时
主持人
参赛人数
4