結果
| 問題 | No.1299 Random Array Score | 
| コンテスト | |
| ユーザー |  platinum | 
| 提出日時 | 2020-11-27 22:47:30 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 88 ms / 2,000 ms | 
| コード長 | 1,253 bytes | 
| コンパイル時間 | 1,632 ms | 
| コンパイル使用メモリ | 169,032 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-26 19:07:01 | 
| 合計ジャッジ時間 | 4,461 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 34 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
using namespace std;
using LL = long long;
using P = pair<int,int>;
LL const mod = 998244353;
struct mint{
	LL x;
	mint(LL x = 0): x(x % mod) {}
	mint& operator += (const mint n){
		x += n.x;
		if(x >= mod) x -= mod;
		return *this;
	}
	mint& operator -= (const mint n){
		x -= n.x;
		if(x < 0) x += mod;
		return *this;
	}
	mint& operator *= (const mint n){
		x *= n.x;
		x %= mod;
		return *this;
	}
	mint operator + (const mint n) const{
		mint res(*this);
		return res += n;
	}
	mint operator - (const mint n) const{
		mint res(*this);
		return res -= n;
	}
	mint operator * (const mint n) const{
		mint res(*this);
		return res *= n;
	}
	mint pow(LL n) const{
		if(n == 0) return 1;
		mint m = pow(n >> 1);
		m *= m;
		if(n & 1) m *= *this;
		return m;
	}
	// mint division for prime mod
	mint inv() const{
		return pow(mod - 2);
	}
	mint& operator /= (const mint n){
		return (*this) *= n.inv();
	}
	mint operator / (const mint n) const{
		mint res(*this);
		return res /= n;
	}
};
int main(){
	int N;
	LL K;
	cin >> N >> K;
	vector<LL> A(N);
	rep(i,N) cin >> A[i];
	mint sum = 0;
	rep(i,N) sum += A[i];
	mint a = 2;
	sum *= a.pow(K);
	cout << sum.x << endl;
	return 0;
}
            
            
            
        