結果
問題 |
No.2963 Mecha DESU
|
ユーザー |
|
提出日時 | 2024-10-23 08:14:59 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 571 bytes |
コンパイル時間 | 206 ms |
コンパイル使用メモリ | 82,080 KB |
実行使用メモリ | 105,300 KB |
最終ジャッジ日時 | 2024-10-26 11:01:25 |
合計ジャッジ時間 | 6,345 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 1 -- * 46 |
ソースコード
from collections import defaultdict MOD=998244353 N,M,K=list(map(int,input().split())) A=list(map(int,input().split())) card=[0]*(N+1) for i in A: if i<=N: card[i]+=1 ans=defaultdict(int) for i in range(1,N+1): cnt=0 for j in range(1,int(i**0.5)+5): if i%j==0: if i//j<j: continue cnt+=card[j] if i//j==j: continue cnt+=card[i//j] ans[M-cnt]+=1 #print(ans) ANS=(N*pow(M,K,MOD))%MOD for i in range(1,M+1): ANS=(ANS-ans[i]*pow(i,K,MOD))%MOD #print(ANS) #print(ans) ANS=(ANS*pow(pow(M,K,MOD),MOD-2,MOD))%MOD print(ANS)