CodeForces - 415B Mashmokh and Tokens
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.
Example
Input5 1 4
12 6 11 9 1Output0 2 3 1 1Input3 1 2
1 2 3Output1 0 1Input1 1 1
1Output0
1 #include<iostream>
2 #include<stdio.h>
3 using namespace std;
4 long long int num[100010];
5 int main()
6 {
7 int n;
8 while(cin>>n)
9 {
10 long long int a,b;
11 scanf("%lld%lld",&a,&b);
12 for(int i=0;i<n;i++)
13 cin>>num[i];
14 long long int ans;
15 for(int i=0;i<n;i++)
16 {
17 ans=((num[i]*a)%b)/a;
18 printf("%lld ",ans);
19 }
20 cout<<endl;
21 }
22 return 0;
23 }
CodeForces - 415B Mashmokh and Tokens的更多相关文章
- Codefroces 415B Mashmokh and Tokens
B. Mashmokh and Tokens time limit per test 1 second memory limit per test 256 megabytes input standa ...
- codeforces 414D Mashmokh and Water Tanks
codeforces 414D Mashmokh and Water Tanks 题意 题解 \(a_i\):第 \(i\) 层的结点个数. \(b_i\):第 \(i\) 层初始有水的结点个数. 如 ...
- Mashmokh and Tokens
Codeforces Round #240 (Div. 2) B;http://codeforces.com/problemset/problem/415/B 题意:老板一天发x张代币券,员工能用它来 ...
- Codeforces 414B Mashmokh and ACM
http://codeforces.com/problemset/problem/414/B 题目大意: 题意:一个序列B1,B2...Bl如果是好的,必须满足Bi | Bi + 1(a | b 代表 ...
- Codeforces 414C Mashmokh and Reverse Operation
题意:给你2^n个数,每次操作将其分成2^k份,对于每一份内部的数进行翻转,每次操作完后输出操作后的2^n个数的逆序数. 解法:2^n个数,可以联想到建立一棵二叉树的东西,比如 2,1,4,3就可以 ...
- codeforces D.Mashmokh and ACM
题意:给你n和k,然后找出b1, b2, ..., bl(1 ≤ b1 ≤ b2 ≤ ... ≤ bl ≤ n),并且对所有的bi+1%bi==0,问有多少这样的序列? 思路:dp[i][j] 表示长 ...
- codeforces C. Mashmokh and Numbers
题意:给你n和k,然后让你找出n个数使得gcd(a1,a2)+gcd(a3,a4)+......的和等于k: 思路:如果n为奇数,让前n-3个数的相邻两个数都为1,n-2和n-1两个数gcd为k-an ...
- CodeForces 415D Mashmokh and ACM
$dp$. 记$dp[i][j]$表示已经放了$i$个数字,并且第$i$个数字放了$j$的方案数.那么$dp[i][j] = \sum\limits_{k|j}^{} {dp[i - 1][k]}$ ...
- @codeforces - 414E@ Mashmokh's Designed Problem
目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定一棵 n 个点的树,每个点的儿子是有序的. 现给定 m 次操 ...
- Codeforces Round #240 (Div. 2)(A -- D)
点我看题目 A. Mashmokh and Lights time limit per test:1 secondmemory limit per test:256 megabytesinput:st ...
随机推荐
- MAUI+Masa Blazor APP 各大商店新手发布指南(三)vivo篇
目录 前言 准备材料 审核流程 测试报告 隐私测试报告 隐私行为数据 其他问题 总结 前言 上架vivo商店,使用厂家的离线推送当然是一个重要原因,与小米不同,vivo的推送服务可以在应用未上架的情况 ...
- BeanUtils.copyProperties:曾经是我的女神,现在是我的毒药。
前言 BeanUtils.copyProperties十有八九是你这些年工作中用的很多的其中一个,不管是Apache的还是Spring的. 网上的解释浩如烟海,我这边用一个超简单的例子直观展示给你看. ...
- 华为云ECS上搭建Hadoop集群环境启动时报错“java.net.BindException: Cannot assign requested address”问题的解决
启动时使用: ./sbin/start-all.sh 1 报错: java.net.BindException: Problem binding to [test7972:9000] java.net ...
- 数据库重构之路,以 OrientDB 到 NebulaGraph 为例
"本文由社区用户 @阿七从第一视角讲述其团队重构图数据库的过程,首发于阿七公众号「浅谈架构」" 原文出处:https://mp.weixin.qq.com/s/WIJNq-nuuA ...
- 实现自动扫描工作区npm包并同步cnpm
省流版: npx cnnc 为避免包名重复,取了2个单词的首尾,cnpm sync 前言 在开发一个多npm包的项目时,时常会一次更新多个包的代码,再批量发布到 npm 镜像源后. 由于国内网络环境的 ...
- 局域网内文件分享的简单方式:python - http.server
在局域网条件下,利用Python自带的HTTP服务功能提供文件共享服务是相对比较简单便捷的方式之一. 一.现实需求及前提条件 1. 文件的服务端(文件分享者)与接收端(文件接收者)在一个局域网,接收端 ...
- 5.2 磁盘CRC32完整性检测
CRC校验技术是用于检测数据传输或存储过程中是否出现了错误的一种方法,校验算法可以通过计算应用与数据的循环冗余校验(CRC)检验值来检测任何数据损坏.通过运用本校验技术我们可以实现对特定内存区域以及磁 ...
- oracle的根容器下新建pdb容器及本地用户
在Oracle12C根容器下,新建pdb,要求根据种子pdb建目的pdb:db_test,配置监听:在目的pdb下建本地用户 首先根据种子pdb新建目的pdb 1.管理员身份登录 C:\WINDOWS ...
- getchar()和putchar()
#include <stdio.h> #include <stdlib.h> int main() { char ch; /*.putchar() a. putchar函数的格 ...
- 多数据源管理:掌握@DS注解的威力
大家在日常后端开发过程,不可避免的会接触到需要用到配置多个数据源的场景,在这里,小编介绍一种简单方便的,只需要简单的配置和一个@DS注解就能实现动态数据源的方式,这种动态数据源底层原理是基于Mybat ...