結果

問題 No.434 占い
ユーザー miraxialmiraxial
提出日時 2016-10-15 00:12:19
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 350 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 18,688 KB
最終ジャッジ日時 2024-05-02 00:01:13
合計ジャッジ時間 6,662 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
12,160 KB
testcase_01 AC 80 ms
12,288 KB
testcase_02 AC 82 ms
12,288 KB
testcase_03 AC 80 ms
12,288 KB
testcase_04 AC 82 ms
12,160 KB
testcase_05 AC 80 ms
12,160 KB
testcase_06 AC 90 ms
12,672 KB
testcase_07 AC 81 ms
12,288 KB
testcase_08 RE -
testcase_09 WA -
testcase_10 AC 97 ms
12,800 KB
testcase_11 AC 89 ms
12,544 KB
testcase_12 AC 141 ms
12,416 KB
testcase_13 RE -
testcase_14 AC 344 ms
15,360 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 TLE -
testcase_18 AC 281 ms
13,824 KB
testcase_19 AC 194 ms
12,672 KB
testcase_20 AC 722 ms
12,672 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 78 ms
12,160 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 242 ms
14,336 KB
testcase_30 AC 579 ms
12,544 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