結果
問題 | No.502 階乗を計算するだけ |
ユーザー | ayaoni |
提出日時 | 2021-07-03 11:27:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,822 bytes |
コンパイル時間 | 328 ms |
コンパイル使用メモリ | 87,140 KB |
実行使用メモリ | 76,104 KB |
最終ジャッジ日時 | 2023-09-12 15:35:52 |
合計ジャッジ時間 | 8,074 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,356 KB |
testcase_01 | AC | 72 ms
71,396 KB |
testcase_02 | AC | 73 ms
71,452 KB |
testcase_03 | AC | 75 ms
71,180 KB |
testcase_04 | AC | 74 ms
71,480 KB |
testcase_05 | AC | 73 ms
71,308 KB |
testcase_06 | AC | 73 ms
71,188 KB |
testcase_07 | AC | 74 ms
71,260 KB |
testcase_08 | AC | 73 ms
71,268 KB |
testcase_09 | AC | 73 ms
71,256 KB |
testcase_10 | AC | 69 ms
71,524 KB |
testcase_11 | AC | 71 ms
71,112 KB |
testcase_12 | AC | 74 ms
71,388 KB |
testcase_13 | AC | 72 ms
71,208 KB |
testcase_14 | AC | 71 ms
71,176 KB |
testcase_15 | AC | 74 ms
71,280 KB |
testcase_16 | AC | 73 ms
71,296 KB |
testcase_17 | AC | 73 ms
71,264 KB |
testcase_18 | AC | 73 ms
71,184 KB |
testcase_19 | AC | 72 ms
71,344 KB |
testcase_20 | AC | 73 ms
70,980 KB |
testcase_21 | AC | 71 ms
71,264 KB |
testcase_22 | AC | 82 ms
75,976 KB |
testcase_23 | AC | 76 ms
76,040 KB |
testcase_24 | AC | 79 ms
75,608 KB |
testcase_25 | AC | 75 ms
75,816 KB |
testcase_26 | AC | 77 ms
75,812 KB |
testcase_27 | AC | 76 ms
75,960 KB |
testcase_28 | AC | 78 ms
75,820 KB |
testcase_29 | AC | 75 ms
75,880 KB |
testcase_30 | AC | 81 ms
75,908 KB |
testcase_31 | AC | 79 ms
75,824 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | AC | 72 ms
71,488 KB |
testcase_43 | AC | 73 ms
71,204 KB |
testcase_44 | AC | 74 ms
71,372 KB |
testcase_45 | AC | 72 ms
71,208 KB |
testcase_46 | AC | 72 ms
71,364 KB |
testcase_47 | AC | 72 ms
71,268 KB |
testcase_48 | AC | 73 ms
71,260 KB |
testcase_49 | AC | 73 ms
71,308 KB |
testcase_50 | AC | 73 ms
71,196 KB |
testcase_51 | AC | 73 ms
71,384 KB |
ソースコード
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) n = I() mod = 10**9+7 if n >= mod: print(0) exit() ''' X = [1] for i in range(1,10**9+7): x = (X[-1]*i) % mod if i % 10**7 == 0: X.append(x) ''' X = [1, 10000000, 998600007, 294000, 999917687, 28812, 719987904, 927205936, 360764682, 152718253, 193097225, 601315142, 534895288, 953245298, 785819620, 174889406, 764123872, 330692601, 763327331, 874774663, 375315483, 878286250, 647439189, 427622916, 121593507, 537211368, 702275322, 612699655, 199108686, 535809374, 74800323, 967683307, 72389408, 472780472, 354782487, 580782917, 656427064, 979853923, 133588584, 395303171, 293151131, 868656266, 166150597, 209886708, 873548950, 748320832, 310406940, 778761180, 783362459, 223066786, 219266256, 777219477, 210921125, 467482635, 132915653, 638274744, 137963022, 989527553, 722518168, 135999988, 228800056, 183023769, 985676855, 303165102, 921820359, 155717397, 300585633, 700253396, 946793865, 276985666, 842770252, 731431882, 353583343, 583189134, 139080308, 269828390, 964512982, 941275070, 460638157, 482671013, 697042351, 357769900, 946400795, 351411422, 413700856, 138479925, 666350862, 881923285, 367352605, 161393288, 183222294, 372873998, 758691475, 810918538, 384156060, 445362222, 127165890, 436543616, 685310820, 50796051, 644427650] ans = X[n//10**7] for i in range((10**7)*(n//10**7)+1,n+1): ans *= i ans %= mod print(ans)