Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.104 s | 9 KBi |
#2 |
Correcto
|
0.09 s | 9 KBi |
#3 |
Correcto
|
0.083 s | 9 KBi |
#4 |
Correcto
|
0.085 s | 9 KBi |
#5 |
Correcto
|
0.115 s | 9 KBi |
#6 |
Correcto
|
0.086 s | 9 KBi |
#7 |
Correcto
|
0.115 s | 9 KBi |
#8 |
Correcto
|
0.082 s | 9 KBi |
#9 |
Correcto
|
0.083 s | 9 KBi |
#10 |
Correcto
|
0.087 s | 9 KBi |
#11 |
Correcto
|
0.093 s | 9 KBi |
#12 |
Correcto
|
0.079 s | 9 KBi |
#13 |
Correcto
|
0.094 s | 9 KBi |
#14 |
Correcto
|
0.113 s | 9 KBi |
#15 |
Correcto
|
0.078 s | 9 KBi |
#16 |
Correcto
|
0.091 s | 9 KBi |
#17 |
Correcto
|
0.11 s | 9 KBi |
#18 |
Correcto
|
0.091 s | 9 KBi |
#19 |
Correcto
|
0.072 s | 9 KBi |
#20 |
Correcto
|
0.079 s | 9 KBi |
#21 |
Correcto
|
0.094 s | 9 KBi |
#22 |
Correcto
|
0.1 s | 9 KBi |
#23 |
Correcto
|
0.087 s | 9 KBi |
#24 |
Correcto
|
0.081 s | 9 KBi |
#25 |
Correcto
|
0.086 s | 9 KBi |
#26 |
Correcto
|
0.111 s | 9 KBi |
#27 |
Correcto
|
0.101 s | 9 KBi |
#28 |
Correcto
|
0.1 s | 9 KBi |
#29 |
Correcto
|
0.109 s | 9 KBi |
#30 |
Correcto
|
0.102 s | 9 KBi |
#31 |
Correcto
|
0.111 s | 9 KBi |
#32 |
Correcto
|
0.1 s | 9 KBi |
#33 |
Correcto
|
0.11 s | 9 KBi |
#34 |
Correcto
|
0.111 s | 9 KBi |
n1 = gets.chomp def sum_one number accumulator = 0 size = number.length one = "1".rjust(size, "0") answer = "0" * size (size - 1).downto(0).each do |index| current_digit = number[index].to_i + one[index].to_i current_digit = current_digit + accumulator answer[index] = (current_digit % 10).to_s accumulator = current_digit / 10 end if accumulator != 0 answer = accumulator.to_s + answer end answer end puts sum_one n1