Developing Skills
题目传送门:点击打开链接
#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的更多相关文章
- 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 ...
- cf581C Developing Skills
Petya loves computer games. Finally a game that he's been waiting for so long came out! The main cha ...
- CF581C Developing Skills 模拟
Petya loves computer games. Finally a game that he's been waiting for so long came out! The main cha ...
- codeforces 581C. Developing Skills 解题报告
题目链接:http://codeforces.com/problemset/problem/581/C 题目意思:给出 n 个数:a1, a2, ..., an (0 ≤ ai ≤ 100).给出值 ...
- 【Henu ACM Round#19 C】 Developing Skills
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 优先把不是10的倍数的变成10的倍数. (优先%10比较大的数字增加 如果k还有剩余. 剩下的数字都是10的倍数了. 那么先加哪一个 ...
- codeforces581C
Developing Skills CodeForces - 581C 你在玩一个游戏.你操作的角色有n个技能,每个技能都有一个等级ai.现在你有k次提升技能的机会(将其中某个技能提升一个等级,可以重 ...
- 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 ...
- 每日英语: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 ...
- Codeforces Round #322 (Div. 2)
水 A - Vasya the Hipster /************************************************ * Author :Running_Time * C ...
随机推荐
- 7 Series GTP IP核使用总结 IP核配置篇
FPGA内嵌收发器相当于以太网中的PHY芯片,但更灵活更高效,线速率也在随着FPGA芯片的发展升级.本文对7系列FPGA内部高速收发器GTP IP核的配置和使用做些简单的总结,以备后续回顾重用.本文是 ...
- bzoj 1492: [NOI2007]货币兑换Cash
Description 小Y最近在一家金券交易所工作.该金券交易所只发行交易两种金券:A纪念券(以下简称A券)和 B纪念券(以下 简称B券).每个持有金券的顾客都有一个自己的帐户.金券的数目可以是一个 ...
- js变量提升与函数提升
在es6之前,js语言并没有块级作用域,即{}形成的作用域,只有全局作用域和函数作用域,所谓的提升,即是将该变量的声明或者函数的声明提升,举个例子 console.log(global); //und ...
- String源码图
String StringBuffer StringBuilder 均为对字符数组的操作. 实现了不同的接口,导致不同的覆写. 实现了同样的接口,适应不同的场景.
- Spring Error : No unique bean of type [org.apache.ibatis.session.SqlSessionFactory] is defined
报错信息: Injection of autowired dependencies failed; nested exception is org.springframework.beans.fa ...
- 用Go校验下载文件之SHA256
用GO校验下载文件之SHA256 原来对计算机和网络使用安全这块不够重视,用了N多年盗版的操作系统和办公软件,为了破解使用过各种激活软件,也安装使用过很多别人破解过的软件:网络下载的文件从不校验.慢慢 ...
- Python Pandas 库的使用例子
主要在jupyter notebook里面熟悉这个库的使用,它的安装方法与实现,可自行搜索. Pandas是一个优秀的数据分析工具,官网:http://pandas.pydata.org/ 相关的库使 ...
- 原来你是这样的JAVA[02]-包、传参、构造器
一.包(package) 在java程序中,一个java源文件称为编译单元,以.java后缀命名.编译单元内可以有一个public类,类名必须与文件名相同.注意:每个编译单元只能有一个public类. ...
- MySQL数据库学习02: SELECT语句
声明:本篇文章大多数内容出自<MySQL必知必会>,仅供学习参考,勿作他用! 第4章 检索数据 4.1 SELECT语句 SELECT子句用于检索数据库中的表数据.它几乎是MySQL中最常 ...
- 启用composer镜像服务
使用composer下载东西,需要FQ时,可使用其镜像服务 安装composer后,命令行执行全局配置 composer config -g repo.packagist composer https ...