Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.157 s | 16 KBi |
#2 |
Incorrecto
|
0.156 s | 15 KBi |
#3 |
Incorrecto
|
0.305 s | 12 KBi |
#4 |
Incorrecto
|
0.159 s | 16 KBi |
#5 |
Correcto
|
0.178 s | 16 KBi |
#6 |
Correcto
|
0.158 s | 15 KBi |
#7 |
Correcto
|
0.157 s | 16 KBi |
#8 |
Correcto
|
0.155 s | 16 KBi |
#9 |
Correcto
|
0.158 s | 16 KBi |
#10 |
Correcto
|
0.155 s | 16 KBi |
#11 |
Correcto
|
0.16 s | 16 KBi |
#12 |
Correcto
|
0.301 s | 12 KBi |
#13 |
Incorrecto
|
0.31 s | 47 KBi |
#14 |
Incorrecto
|
0.16 s | 16 KBi |
#15 |
Incorrecto
|
0.168 s | 16 KBi |
#16 |
Correcto
|
0.146 s | 16 KBi |
#17 |
Incorrecto
|
0.169 s | 16 KBi |
#18 |
Incorrecto
|
0.27 s | 12 KBi |
#19 |
Incorrecto
|
0.178 s | 16 KBi |
#20 |
Correcto
|
0.154 s | 16 KBi |
#21 |
Incorrecto
|
0.169 s | 16 KBi |
#22 |
Incorrecto
|
0.147 s | 16 KBi |
#23 |
Incorrecto
|
0.283 s | 12 KBi |
#24 |
Correcto
|
0.157 s | 16 KBi |
#25 |
Incorrecto
|
0.161 s | 16 KBi |
#26 |
Incorrecto
|
0.193 s | 16 KBi |
#27 |
Incorrecto
|
0.186 s | 16 KBi |
#28 |
Incorrecto
|
0.162 s | 16 KBi |
#29 |
Incorrecto
|
0.241 s | 18 KBi |
#30 |
Incorrecto
|
0.403 s | 21 KBi |
#31 |
Incorrecto
|
0.417 s | 23 KBi |
#32 |
Incorrecto
|
0.6 s | 15 KBi |
#33 |
Incorrecto
|
0.453 s | 21 KBi |
#34 |
Incorrecto
|
0.453 s | 23 KBi |
#35 |
Correcto
|
0.456 s | 21 KBi |
#36 |
Correcto
|
0.471 s | 26 KBi |
#37 |
Incorrecto
|
0.238 s | 18 KBi |
#38 |
Incorrecto
|
0.243 s | 18 KBi |
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sn = new Scanner(System.in); String number = sn.nextLine(); String number2 = sn.nextLine(); List<Integer> longNumber = new ArrayList<>(); List<Integer> longNumber2 = new ArrayList<>(); for (int i = 0; i < number.length(); i++) { longNumber.add(Integer.parseInt(Character.toString(number.charAt(i)))); } for (int i = 0; i < number2.length(); i++) { longNumber2.add(Integer.parseInt(Character.toString(number2.charAt(i)))); } List<Integer> answer = new ArrayList<>(); long index = longNumber.size() - 1; int carry = 0; List<Integer> upTo = longNumber.size() - 1 > index ? longNumber : longNumber2; for (int i = upTo.size() - 1; i >= 0; i--) { int current = carry; if (i < longNumber.size()) { current += longNumber.get(i); } if (i < longNumber2.size()) { current += longNumber2.get(i); } answer.add(0, current % 10); carry = Math.round(current / 10); } if (carry > 0) { answer.add(0, 1); } answer.stream().forEach((i) -> System.out.print(i)); } }