10055 - Hashmat the Brave Warrior

All about problems in Volume 100. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

New poster
Posts: 3
Joined: Mon Dec 22, 2014 6:53 am

Re: 10055 - Hashmat the Brave Warrior

Post by Dimpl »

Is there any reason that UVa would have an issue with Math.abs? My solution was not accepted until I replaced:

System.out.println(Math.abs(a - b));


if (a > b)
System.out.println(b - a);
System.out.println(a - b);
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 10055 - Hashmat the Brave Warrior

Post by lighted »

I think you mean

Code: Select all

if (a > b)
    System.out.println(a - b);
    System.out.println(b - a);
The input numbers are not greater than 2^32
What type did you use for input numbers, int or long? Check code http://ideone.com/ToCMGb
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Post Reply

Return to “Volume 100 (10000-10099)”