CF415B.Mashmokh and Tokens

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Bimokh is Mashmokh's boss. For the following nn days he decided to pay to his workers in a new way. At the beginning of each day he will give each worker a certain amount of tokens. Then at the end of each day each worker can give some of his tokens back to get a certain amount of money. The worker can save the rest of tokens but he can't use it in any other day to get more money. If a worker gives back ww tokens then he'll get dollars.

Mashmokh likes the tokens however he likes money more. That's why he wants to save as many tokens as possible so that the amount of money he gets is maximal possible each day. He has nn numbers x1,x2,...,xnx_{1},x_{2},...,x_{n} . Number xix_{i} is the number of tokens given to each worker on the ii -th day. Help him calculate for each of nn days the number of tokens he can save.

输入格式

The first line of input contains three space-separated integers n,a,b (1<=n<=105; 1<=a,b<=109)n,a,b (1<=n<=10^{5}; 1<=a,b<=10^{9}) . The second line of input contains nn space-separated integers x1,x2,...,xn (1<=xi<=109)x_{1},x_{2},...,x_{n} (1<=x_{i}<=10^{9}) .

输出格式

Output nn space-separated integers. The ii -th of them is the number of tokens Mashmokh can save on the ii -th day.

输入输出样例

  • 输入#1

    5 1 4
    12 6 11 9 1
    

    输出#1

    0 2 3 1 1 
  • 输入#2

    3 1 2
    1 2 3
    

    输出#2

    1 0 1 
  • 输入#3

    1 1 1
    1
    

    输出#3

    0 
首页