• Mashmokh and Tokens


    B. Mashmokh and Tokens
    time limit per test
    1 second
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Bimokh is Mashmokh's boss. For the following n 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 w 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 n numbers x1, x2, ..., xn. Number xi is the number of tokens given to each worker on the i-th day. Help him calculate for each of n days the number of tokens he can save.

    Input

    The first line of input contains three space-separated integers n, a, b (1 ≤ n ≤ 105; 1 ≤ a, b ≤ 109). The second line of input contains n space-separated integers x1, x2, ..., xn (1 ≤ xi ≤ 109).

    Output

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

    Examples
    Input
    5 1 4
    12 6 11 9 1
    Output
    0 2 3 1 1 
    Input
    3 1 2
    1 2 3
    Output
    1 0 1 
    Input
    1 1 1
    1
    Output
    0 

    http://codeforces.com/problemset/problem/415/B
    这题仔细看看就知道意思,挺水的,给的数据有片面性个人认为。
    这里是AC代码:
     1 #include<cstdio>
     2 #include<iostream>
     3 #define ll long long int
     4 int x[100000];
     5 
     6 int main()
     7 {
     8     ll n,a,b,w,z;
     9     while(scanf("%lld%lld%lld",&n,&a,&b)!=EOF){
    10         int i;
    11     for(i=0; i<n; i++)
    12     {
    13         scanf("%lld",&x[i]);
    14         printf("%d ",x[i]*a%b/a);
    15     }
    16     printf("
    ");
    17     }
    18 
    19     return 0;
    20 }


  • 相关阅读:
    九校联考-DL24凉心模拟Day2T2 整除(division)
    九校联考-DL24凉心模拟Day1T3 三米诺 (tromino)
    九校联考-DL24凉心模拟总结
    异常 日志-<多重catch语句>
    时间和日期实例-<Calender计算出生日期相差几天>
    时间和日期-<Date和SimpleDateFormat>
    实用类-<Math类常用>
    实用类-<字符串与基本类型的转换>
    实用类-<装箱与拆箱>
    HashMap的应用
  • 原文地址:https://www.cnblogs.com/zllwxm123/p/7230055.html
Copyright © 2020-2023  润新知