結果

問題 No.432 占い(Easy)
ユーザー miraxialmiraxial
提出日時 2016-10-14 23:23:31
言語 Ruby
(3.3.0)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 11,464 KB
実行使用メモリ 17,784 KB
最終ジャッジ日時 2023-08-14 12:59:56
合計ジャッジ時間 3,795 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,360 KB
testcase_01 AC 83 ms
15,304 KB
testcase_02 AC 81 ms
15,408 KB
testcase_03 AC 81 ms
15,500 KB
testcase_04 AC 83 ms
15,332 KB
testcase_05 AC 83 ms
15,368 KB
testcase_06 AC 84 ms
15,432 KB
testcase_07 AC 84 ms
15,564 KB
testcase_08 AC 84 ms
15,404 KB
testcase_09 AC 93 ms
15,592 KB
testcase_10 AC 83 ms
15,616 KB
testcase_11 AC 86 ms
15,324 KB
testcase_12 AC 97 ms
17,784 KB
testcase_13 AC 96 ms
17,748 KB
testcase_14 AC 85 ms
15,424 KB
testcase_15 AC 84 ms
15,524 KB
testcase_16 AC 85 ms
15,520 KB
testcase_17 AC 85 ms
15,332 KB
testcase_18 AC 92 ms
16,460 KB
testcase_19 AC 89 ms
16,304 KB
testcase_20 AC 87 ms
15,824 KB
testcase_21 AC 85 ms
15,832 KB
testcase_22 AC 84 ms
15,552 KB
testcase_23 AC 86 ms
15,544 KB
testcase_24 AC 91 ms
15,492 KB
testcase_25 AC 91 ms
15,616 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a=[]
c=1
1.upto(1000) do |i|
  a<< c*=i
end
gets.to_i.times do
  n=gets.chomp.split("").map &:to_i
  c=n[0]+(n.length==1 ? 0:n[-1])
  1.upto(n.length-2) do |i|
    c+=n[i]*a[n.length-2]/a[n.length-2-i]/a[i-1]
  end
  c=c.to_s.split("").map(&:to_i).inject(:+)
  c=c.to_s.split("").map(&:to_i).inject(:+)
  p c.to_s.split("").map(&:to_i).inject(:+)
end
0