結果

問題 No.573 a^2[i] = a[i]
ユーザー 0w10w1
提出日時 2017-11-03 22:30:22
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 219 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 35,712 KB
最終ジャッジ日時 2024-05-02 05:05:27
合計ジャッジ時間 10,839 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
18,688 KB
testcase_01 AC 136 ms
18,816 KB
testcase_02 AC 135 ms
18,688 KB
testcase_03 AC 134 ms
18,560 KB
testcase_04 AC 130 ms
18,688 KB
testcase_05 AC 132 ms
18,688 KB
testcase_06 AC 135 ms
18,816 KB
testcase_07 AC 130 ms
18,816 KB
testcase_08 AC 133 ms
18,816 KB
testcase_09 AC 134 ms
18,816 KB
testcase_10 AC 134 ms
18,688 KB
testcase_11 AC 132 ms
18,560 KB
testcase_12 AC 131 ms
18,816 KB
testcase_13 AC 131 ms
18,688 KB
testcase_14 AC 130 ms
18,688 KB
testcase_15 AC 131 ms
18,816 KB
testcase_16 AC 134 ms
18,816 KB
testcase_17 AC 134 ms
18,816 KB
testcase_18 AC 135 ms
18,816 KB
testcase_19 AC 136 ms
18,816 KB
testcase_20 AC 134 ms
18,688 KB
testcase_21 AC 134 ms
18,816 KB
testcase_22 AC 135 ms
18,688 KB
testcase_23 AC 134 ms
18,816 KB
testcase_24 AC 137 ms
18,816 KB
testcase_25 AC 134 ms
18,688 KB
testcase_26 AC 135 ms
18,816 KB
testcase_27 AC 133 ms
18,816 KB
testcase_28 AC 135 ms
18,816 KB
testcase_29 AC 141 ms
18,688 KB
testcase_30 AC 138 ms
18,944 KB
testcase_31 AC 123 ms
18,944 KB
testcase_32 AC 137 ms
18,944 KB
testcase_33 AC 134 ms
18,944 KB
testcase_34 AC 142 ms
19,200 KB
testcase_35 AC 145 ms
19,072 KB
testcase_36 AC 154 ms
19,200 KB
testcase_37 AC 154 ms
19,200 KB
testcase_38 AC 160 ms
19,456 KB
testcase_39 AC 161 ms
19,200 KB
testcase_40 AC 169 ms
19,200 KB
testcase_41 AC 176 ms
19,072 KB
testcase_42 AC 195 ms
19,328 KB
testcase_43 AC 195 ms
19,200 KB
testcase_44 AC 236 ms
20,096 KB
testcase_45 AC 336 ms
20,992 KB
testcase_46 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require 'openssl'
N = gets.to_i
M = 10 ** 9 + 7
F = [1]
1.upto(N) do |i|
  F << F[-1] * i % M
end
puts (1..N).map { |i|
  i.to_bn.mod_exp(N - i, M) * F[N] * (F[i] * F[N - i]).to_bn.mod_exp(M - 2, M)  
} .reduce(:+) % M
0