Problem A

Hashmat the brave warrior

Input: standard input

Output: standard output

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 integer numbers in every line. These two numbers in each line denotes the number of soldiers in Hashmat's army and his opponent's army or vice versa. The input numbers are not greater than 2^32. 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

___________________________________________________________________________________ 
Shahriar Manzoor
16-12-2000

 #include <stdio.h>
#include <math.h>
int main()
{
long long a, b;
for (;scanf("%lld%lld", &a, &b) != EOF;)
printf("%lld\n", a < b ? b - a : a - b);
return ;
}

报告:本题原以为能很容易应付,结果做了两天都没做出来,最后还是参考网上的才完成,现在说下做题出现的问题:1,没看清题意,对or vice versa这个没理解,便理所当然的把第一个当作小于第二个的数。2,2的32次方应用long long来声明定义,却用了int,没理解给出数的范围的意思,其中也暴露了我没理解int型等数据类型的取值范围。3,EOF为CTRL+Z而不是CTRL+C,导致一直出错。

原因:1,英语不熟,且粗心大意,看了个大概便做题。2理所当然了,对数据类型的不熟悉。3对文件相关标志并不理解

解决:1,只能靠学英语解决。暂无解决 。2,int型当是2个字节时,一个字节为8位,则范围是2的-15次方到2的15次方,同理,long long型是8个字节时,则范围是2的-63次方到2的63次方,至于浮点数,暂先不涉猎。3,EOF即end of file,因为文本存储方式为ascii码,则范围为0~255,不存在-1,EOF表-1,返回EOF即表结束,在windows下为CTRL+Z,而linux下则是CTRL+D。

UVa OJ 10055的更多相关文章

  1. uva oj 567 - Risk(Floyd算法)

    /* 一张有20个顶点的图上. 依次输入每个点与哪些点直接相连. 并且多次询问两点间,最短需要经过几条路才能从一点到达另一点. bfs 水过 */ #include<iostream> # ...

  2. UVa OJ 194 - Triangle (三角形)

    Time limit: 30.000 seconds限时30.000秒 Problem问题 A triangle is a basic shape of planar geometry. It con ...

  3. UVa OJ 175 - Keywords (关键字)

    Time limit: 3.000 seconds限时3.000秒 Problem问题 Many researchers are faced with an ever increasing numbe ...

  4. UVa OJ 197 - Cube (立方体)

    Time limit: 30.000 seconds限时30.000秒 Problem问题 There was once a 3 by 3 by 3 cube built of 27 smaller ...

  5. UVa OJ 180 - Eeny Meeny

    Time limit: 3.000 seconds限时3.000秒 Problem问题 In darkest <name of continent/island deleted to preve ...

  6. UVa OJ 140 - Bandwidth (带宽)

    Time limit: 3.000 seconds限时3.000秒 Problem问题 Given a graph (V,E) where V is a set of nodes and E is a ...

  7. 548 - Tree (UVa OJ)

    Tree You are to determine the value of the leaf node in a given binary tree that is the terminal nod ...

  8. UVa OJ 10300

    Problem A Ecological Premium Input: standard input Output: standard output Time Limit: 1 second Memo ...

  9. UVa OJ 10071

    Problem B Back to High School Physics Input: standard input Output: standard output A particle has i ...

随机推荐

  1. MYSQL数据库性能调优之七:其他(读写分离、分表等)

    一.分表 水平划分 垂直划分 二.读写分离 三.选择合理的数据类型 特别是主键 四.文件.图片等大文件使用文件系统存储 五.数据库参数配置 注意:max_connections最大连接数一般设置在10 ...

  2. deque 居然已经实现了 insert 接口

    最近有个开发需求,根据server传递来的广告位来展示某条广告. 但最终存储广告的数据结构是deque,里面存储的东西还是对象(stl 基于拷贝语义). 想了半天,在开头和结尾插入比较方便,在中间插入 ...

  3. Keil MDK Code、RO-data、RW-data、ZI-data数据段

      Program Size: Code=10848 RO-data=780 RW-data=372 ZI-data=868   Code 表示程序代码指令部分 存放在Flash区 RO-data 表 ...

  4. [翻译][Trident] Trident state原理

    原文地址:https://github.com/nathanmarz/storm/wiki/Trident-state ----------------------------- Trident在读写 ...

  5. HDU 2196 Computer (树dp)

    题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2196 给你n个点,n-1条边,然后给你每条边的权值.输出每个点能对应其他点的最远距离是多少 ...

  6. Notepad++配置Python运行环境

    转自:http://www.cnblogs.com/zhcncn/p/3969419.html Notepad++配置Python开发环境   1. 安装Python 1 下载 我选择了32位的2.7 ...

  7. Java中String对象的不可变性

    首先看一个程序 package reverse; public class Reverse { public static void main(String[] args) { String c1=n ...

  8. TMsgThread, TCommThread -- 在delphi线程中实现消息循环

    http://delphi.cjcsoft.net//viewthread.php?tid=635 在delphi线程中实现消息循环 在delphi线程中实现消息循环 Delphi的TThread类使 ...

  9. Windows 错误代码

    Error Messages for Windows http://www.gregorybraun.com/MSWINERR.ZIP Server 4.0 Error Messages   Code ...

  10. PL/pgSQL学习笔记之六

    http://www.postgresql.org/docs/9.1/static/plpgsql-declarations.html 39.3.1. 声明函数参数 传递给函数的参数被用 $1.$2等 ...