結果

問題 No.1325 Subsequence Score
ユーザー t33f
提出日時 2020-12-22 20:06:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 66,176 KB
最終ジャッジ日時 2025-01-17 06:08:38
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
constexpr int M = 998244353;
int main() {
    int n; cin >> n;
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        long long a; cin >> a;
        ans += (i + 2) * a % M;
    }
    if (n == 1) ans /= 2;
    else for (int i = 2; i < n; i++) ans = ans * 2 % M;
    cout << ans << endl;
}
0