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

#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. python各种类型的转换

    #进制转换 ord(x) #将一个字符转换为它的整数值 hex(x) #将一个整数转换为一个十六进制字符串 oct(x) #将一个整数转换为一个八进制字符串 #类型转换int(x [,base ]) ...

  2. input选择框样式修改与自定义

    html自带的选择框样式不好看,并且在ios设备上丑的罚款.所以一般都是自定义样式: 原理:将原来默认的input选择框隐藏,然后控制label的:before与:after,配合矢量图标或者图片来实 ...

  3. 手动编译protobuf3的C++源码

    Windows下编译 官方文档 第三方文档 准备工具 Visual Studio 2013 CMake https://cmake.org/ Git https://git-scm.com/ 需要注意 ...

  4. 发短信utils

    package cn.itcast.bos.utils;   import com.aliyuncs.DefaultAcsClient; import com.aliyuncs.IAcsClient; ...

  5. 阿里云ECS搭建SVN配置外网

    阿里云ECS搭建SVN后,配置外网启动不了,检查云服务器没发现问题,后来发现是阿里云拦截,需要在阿里云控制台ECS安全组新增如下配置:

  6. vue2 watch引用类型 失败原因

    vue中watch基本用法: new Vue({ el: '#t1', data: { a: { b: 1, c: 2 }, }, methods: { ch() { this.a.d=5 //不打印 ...

  7. spring boot 之fastJson的使用(二)

    昨天说了springboot的简单入门程序.今天进一步深入.今天说一下,fastJson的使用.做过springmvc的都知道fastjson.其实boot自带json可是本人用惯了fastjson, ...

  8. 标准模式 怪异模式 盒模型 doctype

    在页面顶部设置 doctype是为了统一标准 浏览器有标准模式和怪异模式 而这两种模式最大区别就是 盒模型的解析不同 ============================== 图片摘自网络 === ...

  9. 【python3之变量,输入输出,判断,循环】

    一.python的基础语法和规则 1.变量 ①.变量的命名规则 语法: (下划线或字母)+(任意数目的字母.数字或下划线) 变量名必须以下划线或字母开头,而后面接任意数目的字母.数字或下划线.下划线分 ...

  10. [Spark内核] 第34课:Stage划分和Task最佳位置算法源码彻底解密

    本課主題 Job Stage 划分算法解密 Task 最佳位置算法實現解密 引言 作业调度的划分算法以及 Task 的最佳位置的算法,因为 Stage 的划分是DAGScheduler 工作的核心,这 ...