結果

問題 No.432 占い(Easy)
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-02-04 22:22:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 11,896 KB
実行使用メモリ 24,032 KB
最終ジャッジ日時 2023-10-21 06:37:40
合計ジャッジ時間 3,652 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
16,116 KB
testcase_01 AC 76 ms
16,116 KB
testcase_02 AC 76 ms
16,116 KB
testcase_03 AC 81 ms
16,116 KB
testcase_04 AC 75 ms
16,116 KB
testcase_05 AC 72 ms
16,116 KB
testcase_06 AC 72 ms
16,116 KB
testcase_07 AC 75 ms
16,116 KB
testcase_08 AC 79 ms
16,116 KB
testcase_09 AC 79 ms
16,116 KB
testcase_10 AC 77 ms
16,116 KB
testcase_11 AC 89 ms
16,452 KB
testcase_12 AC 211 ms
16,688 KB
testcase_13 AC 212 ms
16,684 KB
testcase_14 AC 89 ms
16,452 KB
testcase_15 AC 76 ms
16,116 KB
testcase_16 AC 74 ms
16,116 KB
testcase_17 AC 155 ms
24,032 KB
testcase_18 AC 138 ms
16,724 KB
testcase_19 AC 122 ms
16,768 KB
testcase_20 AC 92 ms
16,512 KB
testcase_21 AC 97 ms
16,748 KB
testcase_22 AC 76 ms
16,116 KB
testcase_23 AC 75 ms
16,116 KB
testcase_24 AC 75 ms
16,116 KB
testcase_25 AC 76 ms
16,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

t = gets.chomp.to_i

ans = []
t.times do
  s = gets.chomp.chars.map(&:to_i)
  while s.size > 1
    u = []
    s.each_cons(2) do |sa, sb|
      c = sa + sb
      c = c.digits.sum if c >= 10
      u << c
    end
    s = u
  end
  ans << s[0]
end

puts ans
0