传送门

题目大意

看式子懂题意系列...

分析

自然想到我们先按比例下取整得到一个值,再按每个人这样分配所产生的值从大到小排序,然后将剩下的几个金币自大到小每人分配一个,代码挺好理解的,详见代码。

代码

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
#define li long long
#define pb push_back
#define mp make_pair
#define y1 y12345678909
#define rii register int
#define pii pair<int,int>
#define r(x) scanf("%d",&x)
#define ck(x) cout<<x<<endl;
#define uli unsigned long long
#define sp cout<<"---------------------------------------------------"<<endl
struct node {
int d,no;
}a[];
int ans[];
inline bool cmp (const node x,const node y){
return x.d<y.d;
}
int main(){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,m,i,z,y,all,x;
r(n),r(m),r(y);
all=m;
for(i=;i<=n;i++){
r(x);
z=x*m;
ans[i]+=z/y;
all-=ans[i];
z%=y;
a[i].d=z;
a[i].no=i;
}
sort(a+,a+n+,cmp);
for(i=n-all+;i<=n;i++)
ans[a[i].no]++;
for(i=;i<=n;i++)
printf("%d ",ans[i]);
puts("");
return ;
}

100197G Robbers的更多相关文章

  1. Codeforces Round #359 (Div. 2)C - Robbers' watch

    C. Robbers' watch time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  2. codeforces 359 C - Robbers' watch

    Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u   Description Robb ...

  3. UVA1616-Caravan Robbers(枚举)

    Problem UVA1616-Caravan Robbers Accept: 160  Submit: 1156Time Limit: 3000 mSec Problem Description O ...

  4. UVA1616-Caravan Robbers(二分)

    Problem UVA1616-Caravan Robbers Accept: 96  Submit: 946Time Limit: 3000 mSec Problem Description Lon ...

  5. Codeforces 658A. Robbers' watch 模拟

    A. Robbers' watch time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...

  6. Codeforces Round #359 (Div. 1) A. Robbers' watch 暴力

    A. Robbers' watch 题目连接: http://www.codeforces.com/contest/685/problem/A Description Robbers, who att ...

  7. SCOJ 4484 The Graver Robbers' Chronicles 后缀自动机

    4484: The Graver Robbers' Chronicles 题目连接: http://acm.scu.edu.cn/soj/problem.action?id=4484 Descript ...

  8. Codeforces Round #359 (Div. 2) C. Robbers' watch 鸽巢+stl

    C. Robbers' watch time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  9. codeforces 686C C. Robbers' watch(dfs)

    题目链接: C. Robbers' watch time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

随机推荐

  1. Angular 4.0 架构详解

    Angular 4.0 架构 这个架构图展现了 Angular 应用中的 8 个主要构造块: 模块 (module) 组件 (component) 模板 (template) 元数据 (metadat ...

  2. 剑指offer--12.不用加减乘除做加法

    位运算,好久没用了 &:都为1,结果为1 ^:相同为0,不同为1 |:有1,结果为1 <<:左移 ----------------------------------------- ...

  3. 利用HTML5开发Android笔记(下篇)

    资源来自于www.mhtml5.com 杨丰盛老师成都场的PPT分享 一个很简明的demo 可以作为入门基础 学习的过程中做了点笔记 整理如下 虽然内容比较简单 但是数量还是比较多的 所以分了3篇 ( ...

  4. MySQL实战 | 05 如何设计高性能的索引?

    原文链接:MySQL | 05 如何设计高性能的索引? 上回我们主要研究了为什么使用索引,以及索引的数据结构.今天带你了解如何设计高性能的索引. 其中,有这么一个点,说的是 InnoDB 引擎中使用的 ...

  5. 隐藏select中的“请选择”项

    <select> <option value="" style="display: none">请选择</option> & ...

  6. QT QString与char *之间的转换 【转载】

    原文网址:http://blog.csdn.net/candyliuxj/article/details/6429208 1.QString转char * 先将QString转换为QByteArray ...

  7. Operating System-进程/线程内部通信-信号量和PV操作

    本文介绍操作系统进程管理的两个核心概念: 信号量 PV操作 一.信号量介绍 1.1 信号量引入 信号量(Semaphore)1965年由Dijkstra引入的.信号量一般由一个值是一个变量,其值有可能 ...

  8. Eclipse jar包源码下载

    在使用intelliJ的时候,可以在IDE中直接下载jar包: Eclipse也可以!就是插件Java Source Attacher 这个插件是放在eclipse安装目录的dropins目录下.重启 ...

  9. spark 算子分析

    别的不说先上官网: action 这些算子中需要注意: 1.reduce 和 reduceByKey 虽说都有reduce,但是一个是action级别,一个是transformation级别,速度上会 ...

  10. HTTP-Runoob:HTTP状态码

    ylbtech-HTTP-Runoob:HTTP状态码 1.返回顶部 1. HTTP状态码 当浏览者访问一个网页时,浏览者的浏览器会向网页所在服务器发出请求.当浏览器接收并显示网页前,此网页所在的服务 ...