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));
with
if (a > b)
System.out.println(b - a);
else
System.out.println(a - b);
10055 - Hashmat the Brave Warrior
Moderator: Board moderators
Re: 10055 - Hashmat the Brave Warrior
I think you mean
Code: Select all
if (a > b)
System.out.println(a - b);
else
System.out.println(b - a);
What type did you use for input numbers, int or long? Check code http://ideone.com/ToCMGbThe input numbers are not greater than 2^32
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman