結果
問題 |
No.2793 Mancala Master
|
ユーザー |
|
提出日時 | 2024-06-24 20:07:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 643 ms |
コンパイル使用メモリ | 67,584 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-25 10:45:23 |
合計ジャッジ時間 | 2,087 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 WA * 1 |
ソースコード
#include<iostream> #include<cassert> #include<atcoder/modint> using namespace std; using mint=atcoder::modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T;cin>>T; for(;T--;) { int N,KK; cin>>N>>KK; mint K=KK; long sum=0; for(int i=1;i<=N;i++) { int A;cin>>A; sum+=(long)i*A; } mint t=1,p=1,k=K.inv(); for(int i=1;i<=N;i++) { t*=p; p+=k.pow(i); } cout<<(K.pow(sum)*(1-k).pow(N)*t).val()<<"\n"; } }