結果

問題 No.2269 eN!の整数部分の下1桁
ユーザー maguroflymagurofly
提出日時 2023-04-15 00:16:49
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 376 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 97,024 KB
最終ジャッジ日時 2024-04-18 21:45:14
合計ジャッジ時間 4,363 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
17,664 KB
testcase_01 AC 82 ms
12,416 KB
testcase_02 AC 78 ms
12,160 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

T = gets.to_i
factorial = [1]
(1 .. 10).each do |i|
    factorial << factorial[-1] * i
end
T.times do
    n = gets.to_i
    ans = 0
    if n >= 5
        i = n
        f = 1
        loop do
            f *= i
            break if f % 10 == 0
            ans += f
        end
    else
        ans = (0 .. n).sum { |i| factorial[n] / factorial[i] }
    end
    puts ans % 10
end
0