传送门

题目大意

看式子懂题意系列...

分析

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

代码

#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. 完成一个servlet 就要在web.xml里面配一个映射,这样就有一个路径供我们 使用????? servlet从页面接收值?

    最后,最容易忘记的是:在dao层中 调用xml里的删除sql语句 后面需要人为加上事务提交.一定要! sqlSession.commit();//jdbc是自动提交,但是mybatis中不是自动提交的 ...

  2. 16_游戏编程模式ServiceLocator 服务定位

    ####简单说,就是某个系统作为一个服务,对全局系统可见. Service Locator (服务定位) ``` //简单粗暴的代码, 使用声音系统 // Use a static class? Au ...

  3. UVA - 1343 The Rotation Game (BFS/IDA*)

    题目链接 紫书例题. 首先附上我第一次bfs+剪枝TLE的版本: #include<bits/stdc++.h> using namespace std; typedef long lon ...

  4. shell 去重

    group=`cat config.properties  |            grep -v "^$" |                 grep -v "^# ...

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

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

  6. 感知机学习算法Java实现

    感知机学习算法Java实现. Perceptron类用于实现感知机, 其中的perceptronOriginal()方法用于实现感知机学习算法的原始形式: perceptronAnother()方法用 ...

  7. phpstorm win/mac git配置 破解

    http://blog.csdn.net/fenglailea/article/details/53350080 phpstorm中git配置教程: http://blog.csdn.net/knig ...

  8. CentOS6.5下安装mongodb

    MongoDB是目前最常用的NoSQL-非关系型数据库. 本文将介绍在CentOS下如何通过yum安装MongoDB. 1.首先在CentOS6.5下,编辑Mongo的yum源: 在/etc/yum. ...

  9. 蓝桥杯 基础练习 BASIC-23 芯片测试

    基础练习 芯片测试   时间限制:1.0s   内存限制:512.0MB 问题描述 有n(2≤n≤20)块芯片,有好有坏,已知好芯片比坏芯片多. 每个芯片都能用来测试其他芯片.用好芯片测试其他芯片时, ...

  10. Spring MVC 项目示例

    Spring MVC是Spring Framework的一部分,是基于Java实现MVC的轻量级Web框架.Spring的web框架围绕DispatcherServlet设计, 作用是将请求分发到不同 ...