/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 233 点
問題文
高橋君は通信工学の実験で、N 個の中継器を通して信号を伝送するシステムを設計しています。
信号は高橋君の送信機から発信され、1 番目の中継器、2 番目の中継器、...、N 番目の中継器へと順番に伝送されていきます。
各中継器 i( 1 \leq i \leq N )には「伝送率」 A_i がパーセント単位の整数値で設定されています。中継器 i に入力される信号の強度を C とすると、中継器 i を通過した後の信号の強度は \left\lfloor \dfrac{C \times A_i}{100} \right\rfloor になります。ここで \lfloor x \rfloor は x 以下の最大の整数(床関数)を表します。
高橋君が送信機から発信する最初の信号の強度は M です。
N 個すべての中継器を順に通過した後の信号の強度を求めてください。
制約
- 1 \leq N \leq 10^5
- 1 \leq M \leq 10^{16}
- 1 \leq A_i \leq 100( 1 \leq i \leq N )
- 入力はすべて整数
入力
N M A_1 A_2 \ldots A_N
- 1 行目には、中継器の個数を表す整数 N と、最初の信号の強度を表す整数 M が、スペース区切りで与えられる。
- 2 行目には、各中継器の伝送率を表す整数 A_1, A_2, \ldots, A_N が、スペース区切りで与えられる。
出力
N 番目の中継器を通過した後の信号の強度を 1 行で出力せよ。
入力例 1
3 100 80 50 60
出力例 1
24
入力例 2
4 7 50 50 50 50
出力例 2
0
入力例 3
8 12345 99 87 73 100 64 58 91 77
出力例 3
2017
入力例 4
20 10000000000000000 97 88 76 100 65 54 43 92 81 70 59 48 37 100 99 83 67 52 41 30
出力例 4
1884542668173
入力例 5
1 1 1
出力例 5
0
Score : 233 pts
Problem Statement
Takahashi is designing a system that transmits a signal through N repeaters as part of a communications engineering experiment.
The signal is emitted from Takahashi's transmitter and is transmitted sequentially to the 1-st repeater, the 2-nd repeater, ..., and the N-th repeater.
Each repeater i (1 \leq i \leq N) has a "transmission rate" A_i set as an integer value in percent. If the strength of the signal input to repeater i is C, then the strength of the signal after passing through repeater i becomes \left\lfloor \dfrac{C \times A_i}{100} \right\rfloor. Here, \lfloor x \rfloor denotes the largest integer not exceeding x (the floor function).
The initial strength of the signal emitted from Takahashi's transmitter is M.
Find the strength of the signal after it has passed through all N repeaters in order.
Constraints
- 1 \leq N \leq 10^5
- 1 \leq M \leq 10^{16}
- 1 \leq A_i \leq 100 (1 \leq i \leq N)
- All inputs are integers.
Input
N M A_1 A_2 \ldots A_N
- The first line contains an integer N representing the number of repeaters and an integer M representing the initial signal strength, separated by a space.
- The second line contains integers A_1, A_2, \ldots, A_N representing the transmission rate of each repeater, separated by spaces.
Output
Print the strength of the signal after passing through the N-th repeater on a single line.
Sample Input 1
3 100 80 50 60
Sample Output 1
24
Sample Input 2
4 7 50 50 50 50
Sample Output 2
0
Sample Input 3
8 12345 99 87 73 100 64 58 91 77
Sample Output 3
2017
Sample Input 4
20 10000000000000000 97 88 76 100 65 54 43 92 81 70 59 48 37 100 99 83 67 52 41 30
Sample Output 4
1884542668173
Sample Input 5
1 1 1
Sample Output 5
0