CF1476B.Inflation

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You have a statistic of price changes for one product represented as an array of nn positive integers p0,p1,,pn1p_0, p_1, \dots, p_{n - 1} , where p0p_0 is the initial price of the product and pip_i is how the price was increased during the ii -th month.

Using these price changes you are asked to calculate the inflation coefficients for each month as the ratio of current price increase pip_i to the price at the start of this month (p0+p1++pi1)(p_0 + p_1 + \dots + p_{i - 1}) .

Your boss said you clearly that the inflation coefficients must not exceed kk %, so you decided to increase some values pip_i in such a way, that all pip_i remain integers and the inflation coefficients for each month don't exceed kk %.

You know, that the bigger changes — the more obvious cheating. That's why you need to minimize the total sum of changes.

What's the minimum total sum of changes you need to make all inflation coefficients not more than kk %?

输入格式

The first line contains a single integer tt ( 1t10001 \le t \le 1000 ) — the number of test cases.

The first line of each test case contains two integers nn and kk ( 2n1002 \le n \le 100 ; 1k1001 \le k \le 100 ) — the length of array pp and coefficient kk .

The second line of each test case contains nn integers p0,p1,,pn1p_0, p_1, \dots, p_{n - 1} ( 1pi1091 \le p_i \le 10^9 ) — the array pp .

输出格式

For each test case, print the minimum total sum of changes you need to make all inflation coefficients not more than kk %.

输入输出样例

  • 输入#1

    2
    4 1
    20100 1 202 202
    3 100
    1 1 1

    输出#1

    99
    0

说明/提示

In the first test case, you can, for example, increase p0p_0 by 5050 and p1p_1 by 4949 and get array [20150,50,202,202][20150, 50, 202, 202] . Then you get the next inflation coefficients:

  1. 50201501100\frac{50}{20150} \le \frac{1}{100} ;
  2. 20220150+501100\frac{202}{20150 + 50} \le \frac{1}{100} ;
  3. 20220200+2021100\frac{202}{20200 + 202} \le \frac{1}{100} ;

In the second test case, you don't need to modify array pp , since the inflation coefficients are already good:

  1. 11100100\frac{1}{1} \le \frac{100}{100} ;
  2. 11+1100100\frac{1}{1 + 1} \le \frac{100}{100} ;
首页