結果

問題 No.1396 Giri
ユーザー anagohirameanagohirame
提出日時 2021-02-14 22:22:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 85,316 KB
最終ジャッジ日時 2023-09-29 16:00:06
合計ジャッジ時間 13,117 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,172 KB
testcase_01 AC 69 ms
71,084 KB
testcase_02 WA -
testcase_03 AC 70 ms
71,104 KB
testcase_04 AC 70 ms
71,200 KB
testcase_05 WA -
testcase_06 AC 70 ms
71,172 KB
testcase_07 AC 69 ms
71,516 KB
testcase_08 AC 70 ms
71,224 KB
testcase_09 AC 70 ms
71,484 KB
testcase_10 AC 70 ms
71,424 KB
testcase_11 AC 69 ms
71,516 KB
testcase_12 AC 69 ms
71,448 KB
testcase_13 AC 71 ms
71,100 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
MOD = 998244353
n = int(input())
prime = [True for _ in range(n+1)]
for i in range(2, n+1):
	if not prime[i]:
		continue
	for j in range(i+i, n+1, i):
		prime[j] = False
#print(prime)
for i in range(n, 1, -1):
	if prime[i]:
		key = i
		break
#print(key)
ans = 1
for i in range(1, n+1):
	if i == key:
		continue
	ans = (ans * i * pow(gcd(ans, i), MOD-2, MOD)) % MOD
print(ans)
0