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】U盘安装启动出现press the enter key to begin the installation process 就不动弹了
今天在物理机上安装centOS6.5 64bit 系统的时候,出现了U盘安装启动出现press the enter key to begin the installation process 就不动 ...
- Makefile编写 一 *****
编译:把高级语言书写的代码转换为机器可识别的机器指令.编译高级语言后生成的指令虽然可被机器识别,但是还不能被执行.编译时,编译器检查高级语言的语法.函数与变量的声明是否正确.只有所有的语法正确.相关变 ...
- Redis队列——PHP操作简单示例
入队操作 <?php $redis = new Redis(); $redis->connect('127.0.0.1',6379); while(True){ try{ $value = ...
- Log4j(2)--日志等级
Log4j根据日志信息的重要程度,分OFF.FATAL.ERROR.WARN.INFO.DEBUG.ALL 当然再细分的话 还有 FATAL(严重错误), 但是Log4j官方建议实际实用的话,Log4 ...
- charles手机抓包配置-1
1.下载和安装Charles 下载和安装Charles软件.安装前要先安装Java运行环境,因为Charles是Java写的. 自己百度云上有破解版 2.安装电脑的Charles证书,对证书进行信任设 ...
- 关于HDU 5952的那些事
内容过后再贴,先发表一下心情和感悟. 这个题,我TLE了十多发,后来看了别人的题解,思路是一样的,他做了剪枝的我也做了,为何他的能过的我的超时?后来发现一个不是主要问题的问题:大家的图存储用的都是前向 ...
- pythonNet08
线程通信 通信方法:多个线程共用进程空间,所以进程的全局变量对进程内线程均可见.线程往往使用全局变量进行通信 注意事项:线程间使用全局变量进行通信,全局变量为共享资源,往往需要同步互斥机制 线程的同步 ...
- c#中的可选参数和命名参数的使用
C#4.0之后出现了一个可选参数这个特性. class Cal { static void Main(string[] args) { test1 t = new test1(); t.Add(, ) ...
- Sqoop导入关系数据库到Hive
参考:segmentfault.com:Sqoop导入关系数据库到Hive Sqoop 是 apache 下用于 RDBMS 和 HDFS 互相导数据的工具.本文以 mysql 数据库为例,实现关系数 ...
- 5_bootstrap之响应式布局|列表|按钮
5.响应式工具 为针对性地在移动页面上展示和隐藏不同的内容,bootStrap提供响应式工具. 可以让开发人员通过该工具决定,在何种屏幕尺寸下,隐藏或者显示某些元素 帮助手册位置:全局CSS样式--- ...