B - SaleBob 买电视啦!
来源:互联网 发布:linux排名 编辑:程序博客网 时间:2024/04/29 07:08
[Submit]
Description
Once Bob got to a sale of old TV sets. Therewere
Input
The first line contains two space-separatedintegers
Output
Output the only number — the maximum sum of money that Bob canearn, given that he can carry at most
Sample Input
5 3-6 0 35 -2 4
8
4 27 0 0 -7
7
[Submit]
#include<iostream>#include<algorithm>#include<cmath>using namespace std;int main(){ int n,m,a[100],i,sun; while(scanf("%d %d",&n,&m)!=EOF) { sun=0; for(i=0;i<n;i++) cin>>a[i]; sort(a,a+n); for(i=0;i<m;i++) { if(a[i]<0) sun+=a[i]; } cout<<abs(sun)<<endl; } return 0;}
- B - SaleBob 买电视啦!
- 买彩票啦
- 今天买本啦!
- 041101买新车啦!爽。
- 2017年,电视到底该怎么买?
- 智能电视算是来了 可是我们买到了么?
- 技术越来越厉害啦。电视能直接摄像。
- ENGLISH资料收集(51)-来看电视啦
- 4年前买的耳机效果越来越好啦
- 电子买赠开始啦~~精品好书免费赠~~
- Github建立自己的个人网站,不需要买域名啦!
- 最近买了服务器和域名,转到新博客啦!!
- 电视
- 电视
- hpu 问题 B: 魏好看买折纸
- 陕西电视7套团团赚买手机被骗的经历!
- SQL 查询顾客买了A和B,但是没有买C
- 台湾前十大科技公司拼不过三星(往后一点三星都不要买啦!)
- Irrationa problem
- Rock-paper-scissors 石头剪刀布
- cosos2dx中使用动画帧创建精灵的问题
- hdu 2203 亲和串
- poj 1002
- B - SaleBob 买电视啦!
- A - Reconnaissance 2 士兵 立正啦…
- MD5加密
- A - Translation字符串匹配问题
- poj 1005
- D - Gifts in a Hexagonal Box
- Count on Cantor 数表
- hdu 1003 递归(DP)
- hdu 3910 两国杀