Codefroces 415B Mashmokh and Tokens
1 second
256 megabytes
standard input
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.
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 n space-separated integers. The i-th of them is the number of tokens Mashmokh can save on the i-th day.
5 1 4
12 6 11 9 1
0 2 3 1 1
3 1 2
1 2 3
1 0 1
1 1 1
1
0 注意数据范围
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll n,a,b,x;
ll s[];
int main()
{
scanf("%lld%lld%lld",&n,&a,&b);
for(int i=;i<n;i++)
{
scanf("%lld",&x);
s[i]=(x*a)%b/a;
}
for(int i=;i<n;i++)
{
if(i) printf(" ");
printf("%lld",s[i]);
}
printf("\n");
return ;
}
Codefroces 415B Mashmokh and Tokens的更多相关文章
- Mashmokh and Tokens
Codeforces Round #240 (Div. 2) B;http://codeforces.com/problemset/problem/415/B 题意:老板一天发x张代币券,员工能用它来 ...
- Codeforces Round #240 (Div. 2)(A -- D)
点我看题目 A. Mashmokh and Lights time limit per test:1 secondmemory limit per test:256 megabytesinput:st ...
- CF Round#240题解
第一次参加CF的比赛,MSK19.30,四个小时的时差真心累,第一次CODE到这么夜-- 一开始做了A,C两题,后来做B题的时候我体力和精神集中度就很低了,导致一直WA在4-- 今天起床后再刷B,终于 ...
- Codeforces Round #240 (Div. 2) B 好题
B. Mashmokh and Tokens time limit per test 1 second memory limit per test 256 megabytes input standa ...
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- [译] ASP.NET MVC 6 attribute routing – the [controller] and [action] tokens
原文:http://www.strathweb.com/2015/01/asp-net-mvc-6-attribute-routing-controller-action-tokens/ 当在Web ...
- Unable to establish connection to tokens
安装openstack后遇到的第一个问题. 执行命令nova list得到如下结果: [root@localhost ~(keystone_admin)]# nova list No handlers ...
- JSON WEB TOKENS
用JWT来保护我们的ASP.NET Core Web API 在上一篇博客中,自己动手写了一个Middleware来处理API的授权验证,现在就采用另外一种方式来处理这个授权验证的问题,毕竟现在也 ...
- Delphi XE5教程11:Tokens
内容源自Delphi XE5 UPDATE 2官方帮助<Delphi Reference>,本人水平有限,欢迎各位高人修正相关错误!也欢迎各位加入到Delphi学习资料汉化中来,有兴趣者可 ...
随机推荐
- OpenGL编程(二)绘制矩形
上次只是创建了一个简单的窗口,把背景颜色修改为蓝色(默认是黑色),并没有向窗口添加任何图形.这次在上次代码的基础上往窗口中添加一个矩形,设置矩形的颜色,大小等. 1.添加矩形 在(参考上次代码)ren ...
- Leaflet绘制多边形
drawPolygon = () => { let points = []; const polygon = new L.Polygon(points); this.map.addLayer(p ...
- Intel投入5亿美元提升14nm工艺CPU需求
虽然14nm行将收尾,但是却有大量的客户在赶“末班车”,导致CPU供货告急. Intel年初宣布增加10亿美元的额外资本支出用于转向更新的.更先进的生产工具,以便增加产能,在本周的第39届纳斯达克投资 ...
- iptables指南
在了解iptables之前我们先了解一下 防火墙 的概念防火墙是由Check Point创立者Gil Shwed于1993年发明并引入国际互联网,防火墙也是一种位于内部网络与外部网络之间的网络安全系统 ...
- back_inserter 与 iterator
查看这里: http://www.cplusplus.com/reference/iterator/back_inserter/ 是用来在最后插入的 注意,这个函数,是隐式特化了.
- LeetCode_Construct Binary Tree from Inorder and Postorder Traversal
一.题目 Construct Binary Tree from Inorder and Postorder Traversal My Submissions Given inorder and pos ...
- python学习之--SyntaxError: Non-ASCII character '\xe5'
在安装好eclipse之后试了一下 创建了了一个pydev project package.module 在test.py中编写最简单的命令 print "helloworld" ...
- Node.js的helloworld 程序
用文本编辑器.如npp,键入例如以下代码.存储成hello.js console.log('hello') console.log('hello %s->%d','jeapedu', 19418 ...
- android系统又一次刷ROM简记(一)
当须要对android系统进行大刀阔斧的改造的时候,应该清晰的了解android各个image的组成才干做到庖丁解牛. 首先在android烧写过程中须要烧写的文件主要包含uboot.bin\boot ...
- FPGA设计中的电源管理(转载)
过去,FPGA设计者主要关心时序和面积使用率问题.但随着FPGA不断取代ASSP和ASIC器件,设计者们现正期望能够开发低功耗设计,在设计流程早期就能对功耗进行正确估算,以及管理和对与FPGA相关的各 ...