UVA - 10055 Hashmat the Brave Warrior
2016-04-22 22:38
316 查看
Hashmat is a brave warrior who with his group of young soldiers moves from one place to another to
fight against his opponents. Before Fighting he just calculates one thing, the difference between his
soldier number and the opponent’s soldier number. From this difference he decides whether to fight or
not. Hashmat’s soldier number is never greater than his opponent.
Input
The input contains two numbers in every line. These two numbers in each line denotes the number
soldiers in Hashmat’s army and his opponent’s army or vice versa. The input numbers are not greater
than 232. Input is terminated by ‘End of File’.
Output
For each line of input, print the difference of number of soldiers between Hashmat’s army and his
opponent’s army. Each output should be in seperate line.
Sample Input
10 12
10 14
100 200
Sample Output
2
4
100
分析:
题目大意:求敌我双方的人数差。
水。
ac代码:
#include <iostream>
using namespace std;
int main()
{
long a,b;
while(cin>>a>>b)
{
cout<<(a<b ? b-a :a-b )<<endl;
}
return 0;
}
fight against his opponents. Before Fighting he just calculates one thing, the difference between his
soldier number and the opponent’s soldier number. From this difference he decides whether to fight or
not. Hashmat’s soldier number is never greater than his opponent.
Input
The input contains two numbers in every line. These two numbers in each line denotes the number
soldiers in Hashmat’s army and his opponent’s army or vice versa. The input numbers are not greater
than 232. Input is terminated by ‘End of File’.
Output
For each line of input, print the difference of number of soldiers between Hashmat’s army and his
opponent’s army. Each output should be in seperate line.
Sample Input
10 12
10 14
100 200
Sample Output
2
4
100
分析:
题目大意:求敌我双方的人数差。
水。
ac代码:
#include <iostream>
using namespace std;
int main()
{
long a,b;
while(cin>>a>>b)
{
cout<<(a<b ? b-a :a-b )<<endl;
}
return 0;
}
相关文章推荐
- 14.spark RDD深度解析
- 我的第一个调试器
- 个人进度03
- Yii2系列教程六:集成编辑器
- Android之TabHost布局
- OSX下brew cask install 本地安装pkg,dmg
- 薛老师软考高项学员:2016年4月13日作业
- (4.2.1.4)EventBus使用详解——新版本SDK
- POJ1017 Packets(贪心)
- python之pandas的使用:数据的导入技巧
- MySQL Workbench update语句错误Error Code: 1175.
- (插入)20150123--图片水印与MVC-02
- Yii2系列教程五:简单的用户权限管理
- C++新手之memset
- 1006
- 从无到有写一个C#弹球小游戏(二)
- thinkphp菜鸟学习笔记(一)
- Hello World
- (4.2.1.3)EventBus使用详解(二)——EventBus使用进阶
- Yii2系列教程四:实现用户注册,验证,登录