結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,312 KB
testcase_01 AC 60 ms
71,492 KB
testcase_02 AC 62 ms
71,436 KB
testcase_03 AC 62 ms
71,328 KB
testcase_04 AC 62 ms
71,436 KB
testcase_05 AC 61 ms
71,308 KB
testcase_06 AC 62 ms
71,200 KB
testcase_07 AC 65 ms
71,244 KB
testcase_08 AC 62 ms
71,244 KB
testcase_09 AC 62 ms
71,400 KB
testcase_10 AC 61 ms
71,308 KB
testcase_11 AC 65 ms
71,352 KB
testcase_12 AC 63 ms
71,232 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 61 ms
71,228 KB
testcase_16 AC 61 ms
71,436 KB
testcase_17 AC 60 ms
71,420 KB
testcase_18 AC 62 ms
71,472 KB
testcase_19 AC 63 ms
71,268 KB
testcase_20 AC 60 ms
71,040 KB
testcase_21 AC 61 ms
71,260 KB
testcase_22 AC 60 ms
71,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# Nが大きすぎる10**15ぐらい
# 全部かける必要ないはず、10**12 = 2**12 * 5**12 が登場すれば右側はすべて0が並ぶ
# 50までで10**12を超える
# WA出た、50以上だと0を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'*12)
else: 
    print(factorial_list[N])
0