結果

問題 No.500 階乗電卓
ユーザー kohei2019kohei2019
提出日時 2022-01-31 23:31:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 71,608 KB
最終ジャッジ日時 2023-09-02 02:26:40
合計ジャッジ時間 2,859 ms
ジャッジサーバーID
(参考情報)
judge13 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,572 KB
testcase_01 AC 69 ms
71,416 KB
testcase_02 AC 68 ms
71,596 KB
testcase_03 AC 68 ms
71,380 KB
testcase_04 AC 68 ms
71,096 KB
testcase_05 AC 68 ms
71,548 KB
testcase_06 AC 68 ms
71,608 KB
testcase_07 AC 69 ms
71,328 KB
testcase_08 AC 69 ms
71,516 KB
testcase_09 AC 69 ms
71,284 KB
testcase_10 AC 68 ms
71,592 KB
testcase_11 AC 69 ms
71,416 KB
testcase_12 AC 68 ms
71,572 KB
testcase_13 AC 67 ms
71,380 KB
testcase_14 AC 67 ms
71,296 KB
testcase_15 AC 69 ms
71,300 KB
testcase_16 AC 67 ms
71,460 KB
testcase_17 AC 69 ms
71,320 KB
testcase_18 AC 68 ms
71,108 KB
testcase_19 AC 67 ms
71,512 KB
testcase_20 AC 68 ms
71,284 KB
testcase_21 AC 67 ms
71,288 KB
testcase_22 AC 68 ms
71,476 KB
権限があれば一括ダウンロードができます

ソースコード

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