結果

問題 No.500 階乗電卓
ユーザー magurogumamaguroguma
提出日時 2017-09-23 22:10:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 273 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-26 15:46:13
合計ジャッジ時間 1,505 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 30 ms
10,624 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 29 ms
10,496 KB
testcase_12 AC 29 ms
10,624 KB
testcase_13 AC 28 ms
10,624 KB
testcase_14 AC 30 ms
10,496 KB
testcase_15 AC 28 ms
10,624 KB
testcase_16 AC 27 ms
10,624 KB
testcase_17 AC 28 ms
10,624 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

N = int(input())
modulo = 10**12

def factorial(a):
    if a==0 or a==1:
        return 1
    else:
        return ((a%modulo) * (factorial(a-1)%modulo))

ans = factorial(N) % modulo
ans = str(ans)
zeros_str = '0'*(12-len(ans))
print(zeros_str+ans)
0