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 ...
随机推荐
- SQL多表查询指南
SQL多表查询指南 在实际的数据库应用中,通常需要查询涉及多个表的数据.SQL提供了多种方法来执行这种多表查询操作. 内连接(INNER JOIN) 内连接是将多个表中满足连接条件的行组合在一起的操作 ...
- .Net8 AOT+VMP简单的逆向分析
1.前言 测试下VMP加密.NET的强度,选了最新的.Net8+AOT编译,用VMP给它加壳.最后逆向下,简单的分析,本篇看下. 2.概述 一.前奏 首先一段简单的C#代码: namespace Te ...
- 上位机使用JS SerialPort进行串口通信, 包含开发环境搭建和完整示例代码
在嵌入式开发中,我们经常需要使用上位机(PC)与一些电路模块进行通信, 用于获取一些传感器的数据,或者发送命令控制相应的电路模块.NodeJS目前支持使用SerialPort模块进行串口通信,本文主要 ...
- KRPANO资源分析工具下载720THINK全景图
提示:目前分析工具中的全景图下载功能将被极速全景图下载大师替代,相比分析工具,极速全景图下载大师支持更多的网站(包括各类KRPano全景网站,和百度街景) 详细可以查看如下的链接: 极速全景图下载大师 ...
- Solution -「CF 1303G」Sum of Prefix Sums
Description Link. 对于一棵树,选出一条链 \((u,v)\),把链上结点从 \(u\) 到 \(v\) 放成一个 长度 \(l\) 的数组,使得 \(\sum_{i=1}^{l}\s ...
- 甲骨文宣布: 也做 PostgreSQL!
PostgreSQL 在开源数据库世界中一直是一个标志性的存在.经过35年的严格开发,它以其可靠性.强大的功能和性能而自豪.DB-engines 的突出显示,其市场份额的增长证明了其适应性强的数据模型 ...
- Robert Kiraly Software Developer
Robert KiralySoftware DeveloperCell Phone: 650-600-2520 Freenode: ##venturesSupports text messages P ...
- MySQL PXC集群新增一个高版本节点
已有的一个 MySQL PXC 集群环境,因为种种原因仅剩一个节点 node1,需要新增一个集群节点 node2. node1 版本:donor version (8.0.21) node2 版本:l ...
- XCODE9.1的一些新问题
自从XCODE7苹果就允许用免费的开发者账号进行真机测试了,但是还是有很多限制的. 在用的过程中发现限制如下: 1.只能生成*.app文件,不能打包成ipa.官方这么说的,但是奇诡的是,我archiv ...
- 码编译安装nginx
1.解释源码安装nginx软件的预编译,编译以及安装,分别是在做什么,需要注意什么? 预编译(configure): ./configure 00prefix=/usr/local/nginx --u ...