結果

問題 No.432 占い(Easy)
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2018-03-11 20:56:59
言語 Ruby
(3.3.0)
結果
AC  
実行時間 579 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 15,232 KB
最終ジャッジ日時 2024-04-23 01:14:45
合計ジャッジ時間 5,450 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
12,160 KB
testcase_01 AC 90 ms
12,160 KB
testcase_02 AC 90 ms
12,160 KB
testcase_03 AC 93 ms
12,160 KB
testcase_04 AC 98 ms
12,416 KB
testcase_05 AC 95 ms
12,160 KB
testcase_06 AC 90 ms
12,160 KB
testcase_07 AC 100 ms
12,416 KB
testcase_08 AC 91 ms
12,160 KB
testcase_09 AC 94 ms
12,288 KB
testcase_10 AC 99 ms
12,416 KB
testcase_11 AC 143 ms
12,288 KB
testcase_12 AC 579 ms
12,544 KB
testcase_13 AC 578 ms
12,416 KB
testcase_14 AC 146 ms
12,416 KB
testcase_15 AC 91 ms
12,160 KB
testcase_16 AC 92 ms
12,288 KB
testcase_17 AC 202 ms
15,232 KB
testcase_18 AC 334 ms
12,416 KB
testcase_19 AC 255 ms
12,416 KB
testcase_20 AC 163 ms
12,544 KB
testcase_21 AC 177 ms
12,544 KB
testcase_22 AC 100 ms
12,288 KB
testcase_23 AC 100 ms
12,416 KB
testcase_24 AC 95 ms
12,288 KB
testcase_25 AC 98 ms
12,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets
readlines.map(&:chomp).each do |s|
  chars = s.chars
  until chars.size == 1
    temp_chars = []
    chars.each_cons(2) do |a, b|
      sum = a.to_i + b.to_i
      temp_chars << (
        sum >= 10 ? sum.to_s[-2..-1].chars.map(&:to_i).inject(:+) : sum
      )
    end
    chars = temp_chars
  end

  puts chars
end
0