結果

問題 No.500 階乗電卓
コンテスト
ユーザー ntuda
提出日時 2023-12-28 14:07:52
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 281 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 134 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2026-04-14 10:24:28
合計ジャッジ時間 1,749 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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