Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.104 s | 16 KBi |
#2 |
Correcto
|
0.098 s | 16 KBi |
#3 |
Correcto
|
0.103 s | 16 KBi |
#4 |
Correcto
|
0.1 s | 16 KBi |
#5 |
Correcto
|
0.102 s | 16 KBi |
#6 |
Correcto
|
0.082 s | 16 KBi |
#7 |
Correcto
|
0.092 s | 16 KBi |
#8 |
Correcto
|
0.08 s | 16 KBi |
#9 |
Correcto
|
0.106 s | 16 KBi |
#10 |
Correcto
|
0.099 s | 16 KBi |
#11 |
Correcto
|
0.105 s | 16 KBi |
#12 |
Correcto
|
0.107 s | 13 KBi |
#13 |
Correcto
|
0.094 s | 16 KBi |
#14 |
Correcto
|
0.105 s | 17 KBi |
#15 |
Correcto
|
0.107 s | 13 KBi |
#16 |
Correcto
|
0.094 s | 15 KBi |
#17 |
Correcto
|
0.09 s | 16 KBi |
#18 |
Correcto
|
0.129 s | 13 KBi |
#19 |
Correcto
|
0.08 s | 16 KBi |
#20 |
Correcto
|
0.101 s | 16 KBi |
#21 |
Correcto
|
0.088 s | 16 KBi |
#22 |
Correcto
|
0.099 s | 16 KBi |
#23 |
Correcto
|
0.104 s | 16 KBi |
#24 |
Correcto
|
0.091 s | 13 KBi |
#25 |
Correcto
|
0.091 s | 13 KBi |
#26 |
Correcto
|
0.102 s | 17 KBi |
#27 |
Correcto
|
0.099 s | 16 KBi |
#28 |
Correcto
|
0.105 s | 16 KBi |
#29 |
Correcto
|
0.104 s | 16 KBi |
#30 |
Correcto
|
0.098 s | 16 KBi |
#31 |
Correcto
|
0.101 s | 16 KBi |
#32 |
Correcto
|
0.105 s | 16 KBi |
#33 |
Correcto
|
0.103 s | 16 KBi |
#34 |
Correcto
|
0.087 s | 16 KBi |
#35 |
Correcto
|
0.1 s | 16 KBi |
#36 |
Correcto
|
0.163 s | 19 KBi |
#37 |
Correcto
|
0.193 s | 23 KBi |
#38 |
Correcto
|
0.178 s | 19 KBi |
#39 |
Correcto
|
0.175 s | 19 KBi |
#40 |
Correcto
|
0.161 s | 19 KBi |
#41 |
Correcto
|
0.17 s | 19 KBi |
#42 |
Correcto
|
0.151 s | 19 KBi |
import java.util.*; import java.lang.*; import java.io.*; class Main { public static void main(String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); String number = sc.nextLine(); String v[] = number.split(""); ArrayList<Integer> list = new ArrayList<>(); for (int i = 0; i < number.length(); i++) { list.add(Integer.parseInt(v[i])); } int digit = sc.nextInt(); System.out.println(sumOne(list,digit)); } public static String sumOne(ArrayList<Integer> list, int digit) { int carry =0; for (int i = list.size()-1; i >= 0; i--) { int sum = list.get(i)+ digit+carry; list.set(i,sum%10); carry=sum/10; digit=0; if(carry==0) return listToString(list, carry); } return listToString(list, carry); } public static String listToString(ArrayList<Integer> list, int carry) { StringBuilder st = new StringBuilder(); if(carry!=0) st.append(carry); for (int numb : list) { st.append(numb); } return st.toString(); } }