Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.165 s | 16 KBi |
#2 |
Correcto
|
0.201 s | 14 KBi |
#3 |
Correcto
|
0.169 s | 26 KBi |
#4 |
Correcto
|
0.178 s | 14 KBi |
#5 |
Correcto
|
0.246 s | 14 KBi |
#6 |
Correcto
|
0.319 s | 19 KBi |
#7 |
Correcto
|
0.171 s | 15 KBi |
#8 |
Correcto
|
0.189 s | 14 KBi |
#9 |
Correcto
|
0.237 s | 14 KBi |
#10 |
Correcto
|
0.16 s | 13 KBi |
#11 |
Correcto
|
0.167 s | 16 KBi |
#12 |
Incorrecto
|
0.197 s | 13 KBi |
#13 |
Correcto
|
0.184 s | 21 KBi |
#14 |
Correcto
|
0.206 s | 19 KBi |
#15 |
Correcto
|
0.159 s | 14 KBi |
#16 |
Incorrecto
|
0.262 s | 16 KBi |
#17 |
Correcto
|
0.305 s | 19 KBi |
#18 |
Correcto
|
0.215 s | 19 KBi |
#19 |
Correcto
|
0.227 s | 17 KBi |
#20 |
Correcto
|
0.314 s | 26 KBi |
#21 |
Incorrecto
|
0.175 s | 16 KBi |
#22 |
Correcto
|
0.266 s | 18 KBi |
#23 |
Correcto
|
0.338 s | 18 KBi |
#24 |
Correcto
|
0.262 s | 19 KBi |
#25 |
Correcto
|
0.215 s | 23 KBi |
#26 |
Incorrecto
|
0.295 s | 48 KBi |
#27 |
Correcto
|
0.266 s | 51 KBi |
#28 |
Correcto
|
0.225 s | 22 KBi |
#29 |
Correcto
|
0.297 s | 15 KBi |
#30 |
Correcto
|
0.431 s | 16 KBi |
#31 |
Correcto
|
0.221 s | 24 KBi |
#32 |
Correcto
|
0.323 s | 21 KBi |
#33 |
Correcto
|
0.224 s | 30 KBi |
#34 |
Correcto
|
0.232 s | 30 KBi |
import java.util.*; public class Main { public static void main(String args[]){ Scanner inputData = new Scanner(System.in); String numRowsColumns = inputData.nextLine(); StringBuilder input = new StringBuilder(); input.append(numRowsColumns); String inputReverse= input.reverse().toString(); int pos=0; for(int i =0; i < numRowsColumns.length();i++) { if(i==numRowsColumns.length()-1) { pos = (numRowsColumns.length() - i) -1; }else { if(inputReverse.charAt(i) == "9".charAt(0) && inputReverse.charAt(i+1)!="9".charAt(0)) { pos = (numRowsColumns.length() - i) -1; break; }; } } pos = (pos==0)?1:pos; String part2= numRowsColumns.substring(pos-1); int sw=0; String valor1=""; String valor2=""; for(int j=part2.length()-1; j >=0; j--) { if(part2.charAt(j)=="9".charAt(0)) { sw=1; valor1+="0"; }else { valor2= Integer.toString(Integer.parseInt(String.valueOf(part2.charAt(j)))+1); break; } } numRowsColumns = numRowsColumns.substring(0,pos-1); System.out.println(((sw==0)?numRowsColumns+part2.substring(0,part2.length()-1)+valor2 + valor1:numRowsColumns + valor2 + valor1)); } }