UVa 10055 Hashmat the Brave Warrior (warrior)

Source: Internet
Author: User

Hashmat the Brave warrior

input: standard input

output: standard output

Hashmat is a brave warrior who with he group of young soldiers moves from one place to another to fight against he oppon Ents. Before fighting he just calculates one thing, the difference between his soldier number and the opponent ' s soldier number. From the difference he decides whether to fight or not. Hashmat ' s soldier number is never greater than he opponent.

Input

The input contains the numbers in every line. These the numbers in each line denotes the number of soldiers in Hashmat's army and his opponent ' s army or vice versa. The input numbers is 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 is in the seperate line.

 

Sample Input: 10 12
10 14
100 200

 

Sample Output: 2
4
100

Parsing: The title meaning is the absolute value of the output two number note the data type of the number, need to use a long long, and note the input and output of long long, with LLD instead of I64D.

#include <stdio.h>
#include <stdlib.h>

int main () {
    long long m, N;

    while (~SCANF ("%lld%lld", &m, &n)) {
        if (M >= N)    printf ("%lld\n", m-n);
        else    printf ("%lld\n", n-m);
    }
    return 0;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.