Codeforces 492C Vanya and Exams(贪心)
来源:互联网 发布:js导出csv插件 编辑:程序博客网 时间:2024/06/02 23:29
题目链接:Codeforces 492C Vanya and Exams
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 1e5 + 5;struct Exams {int a, b;}ex[maxn];int N, R, avg;ll S;inline bool cmp (const Exams& A, const Exams& B) {return A.b < B.b;}void init () {S = 0;scanf("%d%d%d", &N, &R, &avg);for (int i = 0; i < N; i++) {scanf("%d%d", &ex[i].a, &ex[i].b);S += ex[i].a;}sort(ex, ex + N, cmp);}int main () {init();ll ans = 0, T = 1LL * N * avg;for (int i = 0; i < N; i++) {if (S >= T)break;ll add = min((ll)R - ex[i].a, T - S);ans += add * ex[i].b;S += add;}printf("%lld\n", ans);return 0;}
0 0
- Codeforces 492C Vanya and Exams(贪心)
- Codeforces 492C Vanya and Exams【贪心】
- CodeForces 492C Vanya and Exams(贪心)
- CodeForces 492C Vanya and Exams
- Codeforces-492C-Vanya and Exams
- 492C - Vanya and Exams
- C. Vanya and Exams
- Codeforces Round #280 (Div. 2)---C. Vanya and Exams (贪心)
- Codeforces Round #280 (Div. 2)C. Vanya and Exams(贪心)
- codeforce 492C. Vanya and Exams
- Codeforces Round #280 (Div. 2) C. Vanya and Exams
- Codeforces 492B Vanya and Lanterns【贪心】
- CF 280C. Vanya and Exams(div2)
- Codeforces 479C Exams(贪心)
- Codeforces 497C. Exams 贪心
- Vanya and Exams
- Codeforces Round #280 (Div. 2)_C. Vanya and Exams
- codeforces #492B# Vanya and Lanterns(贪心)
- 14.04ubuntu 源文件
- WP开发入门指南:如何学习WP开发?
- 蓝桥杯 BASIC- 矩形面积交
- [LeetCode] Compare Version Numbers
- winphone开发人员中心
- Codeforces 492C Vanya and Exams(贪心)
- Java Map遍历的同时进行元素删除
- 自组织团队建设很容易吗? (问题与对策的思考)
- log4j配置
- X.509 证书 和 taskstats 对应的config选项
- MYSQL数据文件--.frm文件(只有.frm文件时的表结构恢复)
- STL string demo
- Codeforces 492D Vanya and Computer Game
- ASP开发经典教程