結果

問題 No.2963 Mecha DESU
ユーザー ニックネーム
提出日時 2024-11-16 16:33:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 568 ms / 2,000 ms
コード長 260 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 115,328 KB
最終ジャッジ日時 2024-11-16 16:33:43
合計ジャッジ時間 17,777 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 57
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n,m,p = map(int,input().split())
f = [m]*(n+1)
c = Counter(map(int,input().split()))
for k,v in c.items():
    for r in range(1,n//k+1): f[k*r] -= v
x = 0; z = 998244353
for v in f[1:]: x += pow(v,p,z)
print((n-x*pow(m,-p,z))%z)
0