結果

問題 No.502 階乗を計算するだけ
ユーザー vwxyzvwxyz
提出日時 2022-05-01 23:45:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 947 ms / 1,000 ms
コード長 949 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 92,492 KB
最終ジャッジ日時 2023-09-13 16:41:12
合計ジャッジ時間 20,132 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 258 ms
91,316 KB
testcase_01 AC 257 ms
91,528 KB
testcase_02 AC 258 ms
91,668 KB
testcase_03 AC 258 ms
91,420 KB
testcase_04 AC 255 ms
91,644 KB
testcase_05 AC 256 ms
91,460 KB
testcase_06 AC 258 ms
91,676 KB
testcase_07 AC 257 ms
91,432 KB
testcase_08 AC 257 ms
91,600 KB
testcase_09 AC 262 ms
91,580 KB
testcase_10 AC 260 ms
91,460 KB
testcase_11 AC 259 ms
91,648 KB
testcase_12 AC 263 ms
91,576 KB
testcase_13 AC 262 ms
91,588 KB
testcase_14 AC 259 ms
91,460 KB
testcase_15 AC 261 ms
91,424 KB
testcase_16 AC 263 ms
91,576 KB
testcase_17 AC 262 ms
91,656 KB
testcase_18 AC 264 ms
91,432 KB
testcase_19 AC 262 ms
91,376 KB
testcase_20 AC 263 ms
91,676 KB
testcase_21 AC 260 ms
91,604 KB
testcase_22 AC 266 ms
92,468 KB
testcase_23 AC 264 ms
92,228 KB
testcase_24 AC 269 ms
92,188 KB
testcase_25 AC 264 ms
92,072 KB
testcase_26 AC 267 ms
92,176 KB
testcase_27 AC 268 ms
92,248 KB
testcase_28 AC 267 ms
92,192 KB
testcase_29 AC 267 ms
92,244 KB
testcase_30 AC 272 ms
92,172 KB
testcase_31 AC 272 ms
92,328 KB
testcase_32 AC 514 ms
92,076 KB
testcase_33 AC 947 ms
92,492 KB
testcase_34 AC 740 ms
92,204 KB
testcase_35 AC 473 ms
92,048 KB
testcase_36 AC 708 ms
92,412 KB
testcase_37 AC 811 ms
92,240 KB
testcase_38 AC 708 ms
92,052 KB
testcase_39 AC 940 ms
92,388 KB
testcase_40 AC 275 ms
92,452 KB
testcase_41 AC 265 ms
91,452 KB
testcase_42 AC 265 ms
91,332 KB
testcase_43 AC 264 ms
91,568 KB
testcase_44 AC 265 ms
91,464 KB
testcase_45 AC 268 ms
91,456 KB
testcase_46 AC 263 ms
91,656 KB
testcase_47 AC 264 ms
91,428 KB
testcase_48 AC 261 ms
91,652 KB
testcase_49 AC 263 ms
91,320 KB
testcase_50 AC 261 ms
91,400 KB
testcase_51 AC 262 ms
91,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

N=int(readline())
mod=10**9+7
if N>=10**9+7:
    ans=0
else:
    lst=[1,927880474,933245637,668123525,429277690,733333339,724464507,957939114,203191898,586445753,698611116]
    n=N//(10**8)
    ans=lst[n]
    for i in range(n*10**8+1,N+1):
        ans*=i
        ans%=mod
print(ans)
0