結果

問題 No.432 占い(Easy)
ユーザー nonokai10nonokai10
提出日時 2018-03-28 19:36:32
言語 Ruby
(3.2.2)
結果
AC  
実行時間 413 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 11,364 KB
実行使用メモリ 23,016 KB
最終ジャッジ日時 2023-09-07 19:28:27
合計ジャッジ時間 4,926 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,108 KB
testcase_01 AC 81 ms
15,008 KB
testcase_02 AC 82 ms
15,004 KB
testcase_03 AC 84 ms
15,052 KB
testcase_04 AC 89 ms
15,368 KB
testcase_05 AC 84 ms
15,048 KB
testcase_06 AC 83 ms
15,132 KB
testcase_07 AC 86 ms
15,260 KB
testcase_08 AC 83 ms
15,148 KB
testcase_09 AC 86 ms
15,168 KB
testcase_10 AC 87 ms
15,188 KB
testcase_11 AC 116 ms
15,240 KB
testcase_12 AC 413 ms
15,452 KB
testcase_13 AC 412 ms
15,464 KB
testcase_14 AC 115 ms
15,136 KB
testcase_15 AC 83 ms
15,072 KB
testcase_16 AC 83 ms
15,112 KB
testcase_17 AC 143 ms
23,016 KB
testcase_18 AC 247 ms
15,308 KB
testcase_19 AC 190 ms
15,292 KB
testcase_20 AC 132 ms
15,356 KB
testcase_21 AC 138 ms
15,264 KB
testcase_22 AC 86 ms
15,264 KB
testcase_23 AC 85 ms
15,136 KB
testcase_24 AC 86 ms
15,204 KB
testcase_25 AC 86 ms
15,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
n.times do
  a = gets.chomp.split(//).map(&:to_i)
  while a.size != 1
    b = []
    (0...a.size-1).each do |i|
      x = a[i] + a[i+1]
      while x >= 10
        x = x.to_s.split(//).map(&:to_i).sum
      end
      b << x
    end
    a = b
  end
  p a[0]
end
0