結果

問題 No.500 階乗電卓
ユーザー FromBooskaFromBooska
提出日時 2023-02-22 15:08:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 1,358 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 71,472 KB
最終ジャッジ日時 2023-09-29 23:04:24
合計ジャッジ時間 3,440 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 72 ms
71,440 KB
testcase_05 AC 69 ms
71,408 KB
testcase_06 AC 69 ms
71,316 KB
testcase_07 AC 69 ms
71,436 KB
testcase_08 AC 70 ms
71,092 KB
testcase_09 AC 70 ms
70,884 KB
testcase_10 AC 71 ms
71,204 KB
testcase_11 AC 69 ms
71,316 KB
testcase_12 AC 70 ms
71,436 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 70 ms
71,404 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# Nが大きすぎる10**15ぐらい
# 全部かける必要ないはず、10**12 = 2**12 * 5**12 が登場すれば右側はすべて0が並ぶ
# 50までで10**12を超える

factorial_list = [1]
num = 1
for i in range(1, 55):
    #print(i, num)
    factorial_list.append(num)
    num *= i+1
    num %= 10**12

#print(factorial_list)

N = int(input())
if N >= 50:
    print(0)
else: 
    print(factorial_list[N])
0