Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.076 s | 16 KBi |
#2 |
Correcto
|
0.099 s | 16 KBi |
#3 |
Correcto
|
0.085 s | 16 KBi |
#4 |
Correcto
|
0.099 s | 15 KBi |
#5 |
Correcto
|
0.1 s | 16 KBi |
#6 |
Correcto
|
0.153 s | 27 KBi |
#7 |
Correcto
|
0.096 s | 16 KBi |
#8 |
Correcto
|
0.15 s | 24 KBi |
#9 |
Correcto
|
0.098 s | 16 KBi |
#10 |
Correcto
|
0.1 s | 15 KBi |
#11 |
Correcto
|
0.093 s | 16 KBi |
#12 |
Correcto
|
0.101 s | 17 KBi |
#13 |
Correcto
|
0.091 s | 16 KBi |
#14 |
Correcto
|
0.138 s | 31 KBi |
#15 |
Correcto
|
0.1 s | 16 KBi |
#16 |
Correcto
|
0.095 s | 16 KBi |
#17 |
Correcto
|
0.097 s | 16 KBi |
#18 |
Correcto
|
0.097 s | 16 KBi |
#19 |
Correcto
|
0.088 s | 16 KBi |
#20 |
Correcto
|
0.106 s | 17 KBi |
#21 |
Correcto
|
0.086 s | 16 KBi |
#22 |
Correcto
|
0.095 s | 16 KBi |
#23 |
Correcto
|
0.084 s | 16 KBi |
#24 |
Correcto
|
0.088 s | 16 KBi |
#25 |
Correcto
|
0.09 s | 16 KBi |
#26 |
Correcto
|
0.203 s | 26 KBi |
#27 |
Correcto
|
0.201 s | 25 KBi |
#28 |
Correcto
|
0.174 s | 22 KBi |
#29 |
Correcto
|
0.212 s | 21 KBi |
#30 |
Correcto
|
0.217 s | 24 KBi |
#31 |
Correcto
|
0.229 s | 25 KBi |
#32 |
Correcto
|
0.199 s | 25 KBi |
#33 |
Correcto
|
0.186 s | 22 KBi |
#34 |
Correcto
|
0.214 s | 22 KBi |
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String largeNumber = scanner.nextLine(); char[] numberArray = largeNumber.toCharArray(); int numberToAdd = 1; for(int i=numberArray.length-1; i>=0; i--){ int number = convertCharToInt(numberArray[i]); int sum = number + 1; if(sum == 10){ numberArray[i] = convertIntToChar(0); } else { numberArray[i] = convertIntToChar(sum); numberToAdd = 0; break; } } if(numberToAdd == 1){ System.out.print(1); } for(int i=0; i<numberArray.length; i++){ System.out.print(numberArray[i]); } } private static int convertCharToInt(char c){ switch (c){ case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; default: System.out.println("NOT GOOD"); return -1; } } private static char convertIntToChar(int x){ switch (x){ case 0: return '0'; case 1: return '1'; case 2: return '2'; case 3: return '3'; case 4: return '4'; case 5: return '5'; case 6: return '6'; case 7: return '7'; case 8: return '8'; case 9: return '9'; default: System.out.println("NOT GOOD"); return 'n'; } } }