結果

問題 No.500 階乗電卓
ユーザー ntuda
提出日時 2023-12-28 14:07:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 53,424 KB
最終ジャッジ日時 2024-09-27 15:44:37
合計ジャッジ時間 1,942 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
if N >= 50:
    print("0"*12)
    exit()

mod = 10 ** 12
now = 1
f = False
for i in range(1,N+1):
    now *= i
    if now >= 10 ** 12:
        f = True
    now %= mod
    if f:
        ans = ("0" * 12 + str(now))[-12:]
    else:
        ans = str(now)
print(ans)

0