結果

問題 No.289 数字を全て足そう
ユーザー basie23basie23
提出日時 2016-11-26 17:50:35
言語 Ruby
(3.3.0)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 140 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 11,472 KB
実行使用メモリ 15,884 KB
最終ジャッジ日時 2023-08-18 07:52:41
合計ジャッジ時間 3,365 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,116 KB
testcase_01 AC 84 ms
15,080 KB
testcase_02 AC 83 ms
15,212 KB
testcase_03 AC 79 ms
15,076 KB
testcase_04 AC 79 ms
15,220 KB
testcase_05 AC 85 ms
15,120 KB
testcase_06 AC 81 ms
15,168 KB
testcase_07 AC 83 ms
15,668 KB
testcase_08 AC 82 ms
15,676 KB
testcase_09 AC 82 ms
15,056 KB
testcase_10 AC 81 ms
15,448 KB
testcase_11 AC 81 ms
15,604 KB
testcase_12 AC 84 ms
15,816 KB
testcase_13 AC 82 ms
15,612 KB
testcase_14 AC 86 ms
15,864 KB
testcase_15 AC 81 ms
15,828 KB
testcase_16 AC 82 ms
15,372 KB
testcase_17 AC 83 ms
15,636 KB
testcase_18 AC 86 ms
15,784 KB
testcase_19 AC 83 ms
15,600 KB
testcase_20 AC 83 ms
15,864 KB
testcase_21 AC 77 ms
15,104 KB
testcase_22 AC 86 ms
15,884 KB
testcase_23 AC 84 ms
15,356 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s = gets.chomp
num = s.gsub(/[^\d]/, "").split("")
n = num.length
ary = num[0..n-1].map(&:to_i)

i = 0

ary.each do |a|
  i += a
end

puts i
0