传送门

题目大意

看式子懂题意系列...

分析

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

代码

#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. github提交代码时遇到”Everything up-to-date“问题的解决方式

    需要创建一个新分支,将最新代码加入新分支, 再将新分支合并到主分支,然后提交主分支代码到github网站. ---------------------------------------------- ...

  2. 高可用-软件heartbeat的入门介绍

    注:参考互联网整理. 一.简介Linux-HA的全称是High-Availability Linux,它是一个开源项目,这个开源项目的目标是:通过社区开发者的共同努力,提供一个增强linux可靠性(r ...

  3. wordpress 插件 汉化

    http://blog.wpjam.com/article/localizing-a-wordpress-plugin-using-poedit/ 翻译或者说本地化 WordPress 插件和主题可以 ...

  4. UVA 10417 Gift Exchanging

    #include <iostream> #include <cstring> #include <stdio.h> #include <math.h> ...

  5. loj #6247. 九个太阳

    求 $\sum\limits_{i=1}^n [k | i] \times C_n^i$ 膜 $998244353$ $n \leq 10^{15},k \leq 2^{20}$ $k$ 是 $2$ ...

  6. Mycat 在vscode中的开发配置

    mycat是国产目前最被追捧的一款分布式数据库集群软件,有一些公司对数据库和应用都有自己的集群方案,但是更多的是一些面对庞大的数据量,而束手无策. 对于这种问题,我想百分之80遇到的是数据库的瓶颈,所 ...

  7. New Year and Counting Cards

    Your friend has n cards. You know that each card has a lowercase English letter on one side and a di ...

  8. H国的身份证号码(搜索)

    个人心得:巧妙利用数字进行维护就好了,深搜还是有点心得的: #1558 : H国的身份证号码I 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 H国的身份证号码是一个N位 ...

  9. LeetCode Base 7

    原题链接在这里:https://leetcode.com/problems/base-7/#/description 题目: Given an integer, return its base 7 s ...

  10. Python函数-enumerate()

    enumerate(sequence, [start=0]) 作用: 将可循环序列sequence以start开始分别列出序列数据和数据下标,即对一个可遍历的数据对象(如列表.元组或字符串),enum ...