Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.099 s | 16 KBi |
#2 |
Correcto
|
0.084 s | 16 KBi |
#3 |
Correcto
|
0.102 s | 16 KBi |
#4 |
Correcto
|
0.099 s | 16 KBi |
#5 |
Correcto
|
0.08 s | 16 KBi |
#6 |
Correcto
|
0.082 s | 16 KBi |
#7 |
Correcto
|
0.092 s | 13 KBi |
#8 |
Correcto
|
0.098 s | 16 KBi |
#9 |
Correcto
|
0.103 s | 13 KBi |
#10 |
Correcto
|
0.101 s | 16 KBi |
#11 |
Correcto
|
0.097 s | 16 KBi |
#12 |
Correcto
|
0.097 s | 16 KBi |
#13 |
Correcto
|
0.096 s | 16 KBi |
#14 |
Correcto
|
0.095 s | 16 KBi |
#15 |
Correcto
|
0.08 s | 16 KBi |
#16 |
Correcto
|
0.097 s | 13 KBi |
#17 |
Correcto
|
0.102 s | 16 KBi |
#18 |
Correcto
|
0.115 s | 14 KBi |
#19 |
Correcto
|
0.084 s | 16 KBi |
#20 |
Correcto
|
0.099 s | 16 KBi |
#21 |
Correcto
|
0.08 s | 16 KBi |
#22 |
Correcto
|
0.083 s | 16 KBi |
#23 |
Correcto
|
0.099 s | 16 KBi |
#24 |
Correcto
|
0.102 s | 16 KBi |
#25 |
Correcto
|
0.099 s | 13 KBi |
#26 |
Correcto
|
0.1 s | 16 KBi |
#27 |
Correcto
|
0.095 s | 16 KBi |
#28 |
Correcto
|
0.105 s | 17 KBi |
#29 |
Correcto
|
0.096 s | 16 KBi |
#30 |
Correcto
|
0.093 s | 16 KBi |
#31 |
Correcto
|
0.103 s | 16 KBi |
#32 |
Correcto
|
0.078 s | 16 KBi |
#33 |
Correcto
|
0.096 s | 16 KBi |
#34 |
Correcto
|
0.097 s | 16 KBi |
#35 |
Correcto
|
0.095 s | 16 KBi |
#36 |
Correcto
|
0.114 s | 13 KBi |
import java.util.*; public class Main { public static void main(String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = sc.nextInt(); int y = sc.nextInt(); System.out.println(shortestPath(n,x,y)); } public static int shortestPath(int n,int x,int y){ if(x<y) return y-x<n-y+x? y-x : n-y+x; return x-y<n-x+y? x-y : n-x+y; } }