UVA oj 10055 Hashmat the Brave Warrior(坑题)

原创 2016年06月01日 18:23:55
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

最简单的题,然而我错了两发,还是看了题解才知道的,题目要求范围是2^32,而int范围是2^32-1,这个坑我也是醉了

#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    long long int a,b;
    while(~scanf("%lld%lld",&a,&b))
    {
        long long int c = fabs(a-b);
        printf("%lld\n",c);
    }
    return 0;
}


版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

UVa 10055 - Hashmat the Brave Warrior

UVa 13491710 10055 Hashmat the Brave Warrior Accepted C++ 0.745 2014-04...

[解题报告]《算法竞赛入门经典》基础题Volume 0. Getting Started Uva10055 Uva10071 Uva10300 Uva458 Uva494 Uva490 Uva445 Uva488 Uva489 Uva694 Uva457

我爱A水题...嘿嘿... UVA10055 - Hashmat the Brave Warrior入门题,注意数据类型为longlong即可ude #include using namespace ...
  • swm8023
  • swm8023
  • 2011年06月04日 11:38
  • 2920

Volume 0. Getting Started Uva10055, 10071,10300,458,494,490,414,445,488,489,694,457

刘汝佳 算法入门 第一版

uva 10055 uva 457 uva 494

虽说是白书的入门题,但

UVA oj 10300 Ecological Premium(水题)

Ecological Premium Input:  standard input Output:  standard output Time Limit:  1 second ...
  • Sara_YF
  • Sara_YF
  • 2016年06月01日 19:14
  • 180

UVA oj 445 Marvelous Mazes(水题字符串)

Marvelous Mazes Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %l...
  • Sara_YF
  • Sara_YF
  • 2016年06月02日 12:31
  • 142

UVA oj 练习水题 算法入门经典(大数系列)

最近做了很多白皮书(算法入门经典)上面的很多水题,但是考验编程的细心还是很考验的,把一些题记录在这儿 424 - Integer Inquiry  代码改的很烂,很不容易的过了: #include ...

Uva oj (算法入门经典) 排序与检索系列水题系列

Uva10420 - List of Conquests 题意就是首先给出一个n,表示字符的行数,下面n行字母,开头一个单词国家名字,后面一串人名,要你统计出每个国家人出现的次数,并按字母序输出。  ...

ACM/ICPC_uva动态规划题列表

  • 2015年05月21日 09:51
  • 5KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:UVA oj 10055 Hashmat the Brave Warrior(坑题)
举报原因:
原因补充:

(最多只允许输入30个字)