Re: 10055 - Hashmat the Brave Warrior
Posted: Mon Dec 22, 2014 7:00 am
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);
System.out.println(Math.abs(a - b));
with
if (a > b)
System.out.println(b - a);
else
System.out.println(a - b);