题目传送门:点击打开链接

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std; //int a[100010]; struct node{
int p1, p2;
}a[100010]; bool cmp(node a, node b) {
return a.p2 > b.p2;
} bool cmp1(node a, node b) {
return a.p1 > b.p1;
} int main() {
int n, k;
cin >> n>> k;
for (int i = 0; i<n; i++) {
cin >> a[i].p1;
a[i].p2 = a[i].p1 %10;
} sort(a, a+n, cmp);
int flag = 0;
int res = 0; for (int i = 0; i<n; i++) { if (a[i].p2)
flag = 10-a[i].p2;
// cout << flag<< endl;
if (k >= flag) {
res += (a[i].p1 + flag) /10;
a[i].p1 = a[i].p1 + flag;
k -= flag;
flag = 0;
// cout << flag<< endl;
}
else
res += a[i].p1 / 10;
} //cout << res<< endl; //cout << k<< endl;
if (k >= 10) {
//res = 0;
sort(a, a+n, cmp1);
for (int i = 0; i<n; i++) {
if (a[i].p1 < 100) {
int f = 100 - a[i].p1;
//cout << f<< endl<< k<< endl;;
if (f < k) { res += f/10;
k -= f;
}
else {
res += k/10;
k = 0;
}
}
} } cout << res << endl;
return 0; }

Developing Skills的更多相关文章

  1. Codeforces Round #322 (Div. 2) C. Developing Skills 优先队列

    C. Developing Skills Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

  2. cf581C Developing Skills

    Petya loves computer games. Finally a game that he's been waiting for so long came out! The main cha ...

  3. CF581C Developing Skills 模拟

    Petya loves computer games. Finally a game that he's been waiting for so long came out! The main cha ...

  4. codeforces 581C. Developing Skills 解题报告

    题目链接:http://codeforces.com/problemset/problem/581/C 题目意思:给出 n 个数:a1, a2, ..., an (0 ≤ ai ≤ 100).给出值 ...

  5. 【Henu ACM Round#19 C】 Developing Skills

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 优先把不是10的倍数的变成10的倍数. (优先%10比较大的数字增加 如果k还有剩余. 剩下的数字都是10的倍数了. 那么先加哪一个 ...

  6. codeforces581C

    Developing Skills CodeForces - 581C 你在玩一个游戏.你操作的角色有n个技能,每个技能都有一个等级ai.现在你有k次提升技能的机会(将其中某个技能提升一个等级,可以重 ...

  7. How do I learn mathematics for machine learning?

    https://www.quora.com/How-do-I-learn-mathematics-for-machine-learning   How do I learn mathematics f ...

  8. 每日英语:A Better Way To Treat Anxiety

    Getting up the nerve to order in a coffee shop used to be difficult for 16-year-old Georgiann Steely ...

  9. Codeforces Round #322 (Div. 2)

    水 A - Vasya the Hipster /************************************************ * Author :Running_Time * C ...

随机推荐

  1. UVALive 3716 DNA Regions

    题目大意:给定两个长度相等的字符串A和B,与一个百分比p%,求最长的.失配不超过p%的区间长度.O(nlogn). 题目比较简单套路,推推式子就好了. 记S[i]表示到下标i一共有多少个失配,就相当于 ...

  2. kafka副本机制之数据可靠性

    一.概述 为了提升集群的HA,Kafka从0.8版本开始引入了副本(Replica)机制,增加副本机制后,每个副本可以有多个副本,针对每个分区,都会从副本集(Assigned Replica,AR)中 ...

  3. lumen安装后输出hello world

    1.安装composer,具体请百度 2.composer 切换中国镜像,好处自己体会,命令如下 composer config -g repo.packagist composer https:// ...

  4. linux下新建svn项目

    1.新建项目svnadmin create /mnt/fbdisk/svn/newproject 2.会在svn下面建立newproject目录total 24drwxr-xr-x 2 root ro ...

  5. 安装MySQL时提示3306端口已被占用的解决方案

    之前安装过mysql,用的好好的,但是今天开启服务时报异常,无法启动.为省事,于是想到卸载重装,安装过程中发现3306已经被占用,这也是一开始服务无法启动的原因. 看到有人说用fport查看端口号,于 ...

  6. SVN添加用户权限

    点击properties

  7. 求字符数组逆序数(poj1007)

    int InversionNumber(char* s,int len) { int ans=0;  //s逆序数 int A,C,G;  //各个字母出现次数,T是最大的,无需计算T出现次数 A=C ...

  8. UTC 通用格式时间 转换为 时间戳,并格式化为2017-01-01 12:00:00

    在使用阿里云oss获取文件列表是,发现时间格式是这样的 2016-09-20T13:45:04.000Z (尼玛,是什么鬼), 经过度娘的解答,发现这就是传说中的 UTC通用格式时间 问题来了,怎么转 ...

  9. thinkinginjava学习笔记03_基本语法

    由于java是c系语言,基本保留c语言的所有基本操作,就快速过一下: java中的基本操作符仅仅对基本类型有效:=.==.!=对所有对象有效(值传递),String类支持+.+=; 在对基本数据进行算 ...

  10. Python并发实践_03_并发实战之一

    16S数据质控流程,一次下机lane包括很多的项目,每个项目有独立的合同号,一个项目可能包含16S或者ITS两种,通过一个完整的pipeline,将上游拆分好的数据全部整理成可以直接分析的数据.原本这 ...