結果

問題 No.2550 MORE! JUMP! MORE!
ユーザー Today03
提出日時 2023-11-25 18:37:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 618 bytes
コンパイル時間 2,457 ms
コンパイル使用メモリ 195,428 KB
最終ジャッジ日時 2025-02-18 01:07:51
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#if __has_include("Today's/debug.cpp")
#include "Today's/debug.cpp"
#else
#define debug(...)
#define print_line
#define debugc(...)
#define cerr \
	if (false) cerr
#endif
#include <atcoder/modint>
using namespace atcoder;

int main() {
	int N;
	cin >> N;
	vector<int> A(N + 1);
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}
	modint998244353 ans = 0;
	for (int i = 1; i <= N; i++) {
		modint998244353 num = i == 1 ? 1 : (i + 1) * modint998244353::raw(2).pow(i - 2);
		ans += num * A[i] * modint998244353::raw(2).pow(max(0, N - i - 1));
	}
	cout << ans.val() << endl;
}
0