Naruto and Sasuke are on a S- Rank mission. They got bored and thought of competing in a race against each other in a horizontal plane. They decided a common spot "C" at which both of them will try to reach. Whoever reaches first wins the race, both of them run at the same speed. Given initial positions of Naruto and Sasuke you need to tell which of them will win the race. If Naruto wins print "N" ( without the quotes ), if Sasuke wins print "S" ( without the quotes ). if both of them reach the common spot at the same time, print "D" (for draw, without the quotes ). Input
static char Race(int A,int B,int C){ int naruto = Math.abs(A - C); int sasuke = Math.abs(B - C); if(naruto<sasuke){
return 'N';
}if(naruto>sasuke){
return 'S' ;
}
else return 'D' ; }