Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.1 s | 16 KBi |
#2 |
Correcto
|
0.089 s | 16 KBi |
#3 |
Correcto
|
0.099 s | 16 KBi |
#4 |
Correcto
|
0.136 s | 14 KBi |
#5 |
Correcto
|
0.095 s | 17 KBi |
#6 |
Correcto
|
0.089 s | 17 KBi |
#7 |
Correcto
|
0.091 s | 16 KBi |
#8 |
Correcto
|
0.137 s | 14 KBi |
#9 |
Correcto
|
0.137 s | 21 KBi |
#10 |
Correcto
|
0.131 s | 14 KBi |
#11 |
Correcto
|
0.092 s | 16 KBi |
#12 |
Correcto
|
0.094 s | 16 KBi |
#13 |
Correcto
|
0.096 s | 16 KBi |
#14 |
Correcto
|
0.145 s | 14 KBi |
#15 |
Correcto
|
0.095 s | 16 KBi |
#16 |
Correcto
|
0.088 s | 16 KBi |
#17 |
Correcto
|
0.079 s | 16 KBi |
#18 |
Correcto
|
0.106 s | 17 KBi |
#19 |
Correcto
|
0.08 s | 16 KBi |
#20 |
Correcto
|
0.094 s | 16 KBi |
#21 |
Correcto
|
0.468 s | 16 KBi |
#22 |
Correcto
|
0.094 s | 16 KBi |
#23 |
Correcto
|
0.447 s | 22 KBi |
#24 |
Correcto
|
0.198 s | 16 KBi |
#25 |
Correcto
|
0.269 s | 16 KBi |
#26 |
Correcto
|
0.267 s | 16 KBi |
#27 |
Correcto
|
0.228 s | 14 KBi |
#28 |
Correcto
|
0.241 s | 16 KBi |
#29 |
Correcto
|
0.159 s | 17 KBi |
#30 |
Correcto
|
0.468 s | 16 KBi |
#31 |
Correcto
|
0.192 s | 16 KBi |
#32 |
Correcto
|
0.134 s | 16 KBi |
#33 |
Correcto
|
0.124 s | 16 KBi |
#34 |
Correcto
|
0.644 s | 17 KBi |
#35 |
Correcto
|
0.475 s | 17 KBi |
#36 |
Correcto
|
0.338 s | 16 KBi |
#37 |
Correcto
|
0.506 s | 14 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 t = scanner.nextInt(); int l = scanner.nextInt(); int count = 0; while(t != l){ count++; t = getFuturePosition(t, 1, n); l = getFuturePosition(l, 2, n); } System.out.println(count); } private static int getFuturePosition(int currentPosition, int steps, int sizeArray){ if(currentPosition + steps >= sizeArray){ return currentPosition + steps - sizeArray; } return currentPosition + steps; } }