QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#7892. 光线

統計

当一束光打到一层玻璃上时,有一定比例的光会穿过这层玻璃,一定比例的光会被反射回去,剩下的光被玻璃吸收。

设对于任意 $x$,有 $x\times a_i\%$ 单位的光会穿过它,有 $x\times b_i\%$ 的会被反射回去。

现在 $n$ 层玻璃叠在一起,有 $1$ 单位的光打到第 $1$ 层玻璃上,那么有多少单位的光能穿过所有 $n$ 层玻璃呢?

输入格式

当一束光打到一层玻璃上时,有一定比例的光会穿过这层玻璃,一定比例的光会被反射回去,剩下的光被玻璃吸收。

设对于任意 $x$,有 $x\times a_i\%$ 单位的光会穿过它,有 $x\times b_i\%$ 的会被反射回去。

现在 $n$ 层玻璃叠在一起,有 $1$ 单位的光打到第 $1$ 层玻璃上,那么有多少单位的光能穿过所有 $n$ 层玻璃呢?

输出格式

输出一行一个整数,表示穿透所有玻璃的光对 $10^9 + 7$ 取模的结果。

可以证明,答案一定为有理数。设答案为 $a/b$($a$ 和 $b$ 是互质的正整数),你输出的答案为 $x$,你需要保证 $a\equiv bx \pmod {10^9 + 7}$。

样例数据

样例输入

2
50 20
80 5

样例输出

858585865

样例解释

problem_7892_1.png

如图,光线从左上角打进来,有 $0.5$ 单位的光穿过第 $1$ 层玻璃,有 $0.2$ 单位的光被反射回去。这 $0.5$ 单位的光有 $0.4$ 单位穿过第 $2$ 层玻璃,有 $0.025$ 单位的光被反射回去。这 $0.025$ 单位的光有 $0.0125$ 单位穿过第 $1$ 层玻璃,有 $0.005$ 单位的光被反射回去。这 $0.005$ 单位的光有 $0.004$ 单位穿过第 $2$ 层玻璃……于是,穿过两层玻璃的光一共有 $0.40404... = \frac{40}{99}$ 单位。在模 $10^9+7$ 意义下等于 $858585865$。

样例输入

3
1 2
3 4
5 6

样例输出

843334849

子任务

对于 $5\%$ 的数据,保证 $n=1$。

对于 $20\%$ 的数据,保证 $n\le 2$。

对于 $30\%$的数据,保证 $n\le 3$。

对于 $50\%$ 的数据,保证 $n\le 100$。

对于 $70\%$ 的数据,保证 $n\le 3000$。

对于 $100\%$ 的数据:

  • $1\le n\le 5\times 10^5$
  • $1\le a_i \le 100$
  • $0\le b_i \le 99$
  • $1\le a_i+b_i \le 100$
  • 每组 $a_i$ 和 $b_i$ 在满足上述限制的整数中随机生成。
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.