codeforces 873A Chores
来源:互联网 发布:java多线程lock接口 编辑:程序博客网 时间:2024/06/05 01:00
http://codeforces.com/problemset/problem/873/A
给出n个作业需要的时间,有k次机会将某一作业的时间缩小到q,问最终最小的和多少
将时间排序,再看k和n如果k>=n 答案就是n*q,否则就将前k大的都变成q再求和。
#include<bits/stdc++.h>using namespace std;int main(){int n,k,x;while(cin>>n>>k>>x){int a[1111];int i;for(i=1;i<=n;i++)cin>>a[i];if(n<=k)cout<<x*n<<endl;else {int ans=x*k;for(i=1;i<=n-k;i++)ans+=a[i];cout<<ans<<endl;}}return 0;}
阅读全文
0 0
- codeforces 873A Chores
- codeforces——873A —— Chores
- Educational Codeforces Round 30 837A. Chores
- CF 873 A. Chores【sort】
- Chores
- poj1949 chores
- DP: Chores
- CodeForces-a
- Codeforces 903A A
- poj 1949 Chores
- Work chores--(一)
- Work chores--(二)
- poj 1949 Chores
- POJ 1949 Chores
- poj 1949 Chores
- POJ Chores - from lanshui_Yang
- 【usaco2002.4】Chores
- ACM POJ 1949 Chores
- 2. Add Two Numbers
- JavaScript中的正则表达式解析(一)——数字的匹配
- 后台接口提供的调用方法类型
- iOS系统库头文件中NS_AVAILABLE宏定义
- 长连接与短连接
- codeforces 873A Chores
- unavailable function 'system': not available on iOS xcode 升级后 cocos项目报错
- VS Code 隐藏代码块的参考虚线
- 个人博客项目与功能构建
- ThreeJS学习笔记(7)- 程序的性能
- (碎片代码)
- 递归遍历XML文档
- 2017.10.14 使用ASimpleCache缓存
- 论csdn谁最帅