Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.091 s | 16 KBi |
#2 |
Correcto
|
0.149 s | 13 KBi |
#3 |
Correcto
|
0.09 s | 16 KBi |
#4 |
Correcto
|
0.092 s | 17 KBi |
#5 |
Correcto
|
0.094 s | 16 KBi |
#6 |
Correcto
|
0.094 s | 16 KBi |
#7 |
Correcto
|
0.135 s | 13 KBi |
#8 |
Correcto
|
0.094 s | 16 KBi |
#9 |
Correcto
|
0.093 s | 16 KBi |
#10 |
Correcto
|
0.087 s | 16 KBi |
#11 |
Correcto
|
0.084 s | 16 KBi |
#12 |
Correcto
|
0.096 s | 16 KBi |
#13 |
Correcto
|
0.089 s | 16 KBi |
#14 |
Correcto
|
0.087 s | 17 KBi |
#15 |
Correcto
|
0.143 s | 15 KBi |
#16 |
Correcto
|
0.092 s | 16 KBi |
#17 |
Correcto
|
0.078 s | 17 KBi |
#18 |
Correcto
|
0.097 s | 16 KBi |
#19 |
Correcto
|
0.093 s | 16 KBi |
#20 |
Correcto
|
0.083 s | 16 KBi |
#21 |
Correcto
|
0.091 s | 16 KBi |
#22 |
Correcto
|
0.094 s | 16 KBi |
#23 |
Correcto
|
0.144 s | 14 KBi |
#24 |
Correcto
|
0.09 s | 16 KBi |
#25 |
Correcto
|
0.11 s | 17 KBi |
#26 |
Correcto
|
0.151 s | 14 KBi |
#27 |
Correcto
|
0.088 s | 16 KBi |
#28 |
Correcto
|
0.087 s | 16 KBi |
#29 |
Correcto
|
0.11 s | 17 KBi |
#30 |
Correcto
|
0.095 s | 16 KBi |
#31 |
Correcto
|
0.092 s | 16 KBi |
#32 |
Correcto
|
0.093 s | 16 KBi |
#33 |
Correcto
|
0.149 s | 14 KBi |
#34 |
Correcto
|
0.093 s | 17 KBi |
#35 |
Correcto
|
0.089 s | 16 KBi |
#36 |
Correcto
|
0.09 s | 16 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int start = scanner.nextInt(); int end = scanner.nextInt(); if(start == end){ System.out.println(0); return; } int lenghtForward = start < end ? end - start : (n - start) + end; int lenghtBackward = start > end ? start - end : (n - end) + start; if(lenghtForward < lenghtBackward){ System.out.println(lenghtForward); } else { System.out.println(lenghtBackward); } } }