結果

問題 No.1299 Random Array Score
ユーザー takumat
提出日時 2020-11-28 01:35:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 1,049 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 192,896 KB
最終ジャッジ日時 2025-01-16 09:02:01
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 998244353LL; //1000000007LL;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}
template <class _T> static _T tp_modpow(_T x, _T exp, _T mod = (_T)1) {
	_T ans = 1;
	_T base = x;
	while (exp > 0) {
		if (exp & (_T)1) {
			ans = (ans * base) % mod;
		}
		base = (base * base) % mod;
		exp >>= (_T)1;
	}
	return ans;
}

static void A_task();

int main()
{
	A_task();
	fflush(stdout);
	return 0;
}

static void A_task()
{
	int N;
	get(N);
	LLONG K;
	get(K);

	LLONG sum = 0;
	std::vector<LLONG> ai(N);
	for (int i = 0; i < N; i++) {
		get(ai[i]);
		sum += ai[i];
	}

	LLONG mul = tp_modpow<LLONG>(2LL, K, MOD_NUM);
	printf("%lld\n", ((sum % MOD_NUM) * mul) % MOD_NUM);
}
0