URAL1991 The battle near the swamp 2017-04-12 18:07 92人阅读 评论(0) 收藏
The battle near the swamp
Jar Jar: What? Mesa no have a booma!
Gungan: Here. Taken dis one.
order to get the droids of the Federation out from the capital. The gungan ruler Boss Nass was so grateful for uniting the nations that he appointed Jar Jar a general.
have a foolproof weapon against droids, which is small energy balls called boom booms. One such ball can disable exactly one droid.
of boom booms that will be left unused and the number of droids that will survive the attack. You can assume that when a boom boom is fired at a droid by a gungan, it always hits the target.
the number of boom-booms in the i-th truck.
| input | output |
|---|---|
4 5 |
2 8 |
—————————————————————————————————————
题目的意思是给出n个地区,每个地区有ai个机器人,每个地区投放k歌炸弹,每个炸弹可以炸死1个机器人,问最后幸存的机器人数量和剩下的炸弹的数量
#include <iostream>
#include <cstdio>
using namespace std; int main()
{
int x,y,a;
while(~scanf("%d%d",&x,&y))
{
int ans1=0,ans2=0;
for(int i=0;i<x;i++)
{
scanf("%d",&a);
if(y>a) ans1+=y-a;
else ans2+=a-y;
}
printf("%d %d\n",ans2,ans1);
}
return 0;
}
URAL1991 The battle near the swamp 2017-04-12 18:07 92人阅读 评论(0) 收藏的更多相关文章
- cubieboard变身AP 分类: ubuntu cubieboard 2014-11-25 14:04 277人阅读 评论(0) 收藏
加载bcmdhd模块:# modprobe bcmdhd 如果你希望开启 AP 模式,那么:# modprobe bcmdhd op_mode=2 在/etc/modules文件内添加bcmdhd o ...
- HDU6029 Graph Theory 2017-05-07 19:04 40人阅读 评论(0) 收藏
Graph Theory Time Limit: 2000/1000 M ...
- hdu 1159, LCS, dynamic programming, recursive backtrack vs iterative backtrack vs incremental, C++ 分类: hdoj 2015-07-10 04:14 112人阅读 评论(0) 收藏
thanks prof. Abhiram Ranade for his vedio on Longest Common Subsequence 's back track search view in ...
- 哈希-Gold Balanced Lineup 分类: POJ 哈希 2015-08-07 09:04 2人阅读 评论(0) 收藏
Gold Balanced Lineup Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 13215 Accepted: 3873 ...
- Gold Coins 分类: POJ 2015-06-10 15:04 16人阅读 评论(0) 收藏
Gold Coins Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 21767 Accepted: 13641 Desc ...
- Segment Tree 分类: ACM TYPE 2014-08-29 13:04 97人阅读 评论(0) 收藏
#include<iostream> #include<cstdio> using namespace std; struct node { int l, r, m; int ...
- ubuntu14.04使用root用户登录桌面 分类: 学习笔记 linux ubuntu 2015-07-05 10:30 199人阅读 评论(0) 收藏
ubuntu安装好之后,默认是不能用root用户登录桌面的,只能使用普通用户或者访客登录.怎样开启root用户登录桌面呢? 先用普通用户登录,然后切换到root用户,然后执行如下命令: vi /usr ...
- Windows Media Player axWindowsMediaPlayer1 分类: C# 2014-07-28 12:04 195人阅读 评论(0) 收藏
属性/方法名: 说明: [基本属性] URL:String; 指定媒体位置,本机或网络地址 uiMode:String; 播放器界面模式,可为Full, Mini, None, Invisible p ...
- iOS开发之监听键盘高度的变化 分类: ios技术 2015-04-21 12:04 233人阅读 评论(0) 收藏
最近做的项目中,有一个类似微博中的评论转发功能,屏幕底端有一个输入框用textView来做,当textView成为第一响应者的时候它的Y值随着键盘高度的改变而改变,保证textView紧贴着键盘,但又 ...
随机推荐
- 【linux】用户与组
一.用户和组的基本概念 1.用户 用户:用于获取计算机资源或服务的标识符,比如用户名.计算机处理的是UID, ...
- 1、hadoop HA分布式集群搭建
概述 hadoop2中NameNode可以有多个(目前只支持2个).每一个都有相同的职能.一个是active状态的,一个是standby状态的.当集群运行时,只有active状态的NameNode是正 ...
- Train-Alypay-Cloud:蚂蚁大数据平台培训开课通知(第三次)- 培训笔记3(机器学习平台)
ylbtech-Train-Alypay-Cloud:蚂蚁大数据平台培训开课通知(第三次)- 培训笔记3(机器学习平台) 机器学习平台 一站式可视化机器学习 https://pai.cloud.ali ...
- thinkPHP使用函数时字符串中不能含有管道符”|“,否则报错;
如 {$data.name|str_repeat="|",###}报错!!!
- 基础html和css知识
No1.HTML 1.网页结构 网页结构一般都包含文档声明DOCTYPE,并且在head中的meta应该包含编码格式.关键字.网页描述信息.简单格式如下: <!DOCTYPE html> ...
- Requests抓取火车票数据
1.数据接口 https://kyfw.12306.cn/otn/lcxxcx/query?purpose_codes=ADULT&queryDate=2016-08-01&from_ ...
- 「小程序JAVA实战」小程序的视频点赞功能开发(62)
转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudeshipindianzangongnengkaifa61/ 视频点 ...
- 使用libcurl显示下载进度
使用libcurl显示下载进度 http://blog.csdn.net/zhouzhenhe2008/article/details/53876622
- XML解析的二种方法之dom解析
XML解析的二种方法:dom解析和sax解析 文件大小 存储位置 读取速度 dom解析 小文件 放在内存中 快 sax解析 ...
- Python Modules
[Python Modules] 1. a module is a python source file. 2. a package is a directory with a __init__.py ...