結果
問題 | No.1299 Random Array Score |
ユーザー |
|
提出日時 | 2020-11-28 13:52:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 640 bytes |
コンパイル時間 | 1,571 ms |
コンパイル使用メモリ | 166,552 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-12 22:24:34 |
合計ジャッジ時間 | 3,072 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; const int MOD2=998244353; ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; } inline char tc(void){ static char fl[10000],*A=fl,*B=fl; return A==B&&(B=(A=fl)+fread(fl,1,10000,stdin),A==B)?EOF:*A++; } inline int read(void){ int a=0;char c; while((c=tc())<'0'||c>'9'); while(c>='0'&&c<='9')a=a*10+c-'0',c=tc(); return a; } int main(){ int n,x; long long int k,sum=0; cin>>n>>k; while(n--){ x=read(); sum+=x; } printf("%lld\n",((sum%MOD2)*modpow(2,k,MOD2))%MOD2); }