結果

問題 No.500 階乗電卓
ユーザー kohei2019
提出日時 2022-01-31 23:31:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 51,968 KB
最終ジャッジ日時 2024-06-11 09:06:03
合計ジャッジ時間 1,656 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
mod = 1000000000000
ans = 1
f = False
for i in range(1,N+1):
    ans *= i
    if f==False and (ans //mod >= 1):
        f = True
    ans %= mod
    if ans == 0:
        break
if f:
    l = str(ans)
    print('0'*(12-len(l))+str(ans))
else:
    print(ans)
0