10055 – Hashmat the Brave Warrior Solution

This is an easy problem from uva judge https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=996

How I did it

  • I read the input until I find EOF.
  • Print the absolute value of the substraction.
  • Accepted! 😀

Hints.

  • Don´t use int.

Code

/*
*Author: Fabian Calsina
*Date: 30/06/2016
*/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    long a, b;

    while(scanf("%ld %ld", &a, &b) != EOF)

        printf("%ld\n", abs(a-b));

return 0;
}

Leave a comment