結果
| 問題 |
No.2111 Sum of Diff
|
| コンテスト | |
| ユーザー |
kyushu1996
|
| 提出日時 | 2022-11-03 19:30:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 628 bytes |
| コンパイル時間 | 790 ms |
| コンパイル使用メモリ | 97,852 KB |
| 最終ジャッジ日時 | 2025-02-08 17:00:43 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
#include <map>
#define ll long long
#define endl '\n'
using namespace std;
// category :
int main() {
ios_base::sync_with_stdio(false);
int n; cin>>n;
ll a[n+1],pow2[n+1]={1}, ans=0;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=1;i<=n;i++) pow2[i]=pow2[i-1]*2%998244353ll;
for(int i=1;i<=n;i++){
ans += a[i] * (pow2[n-i]-pow2[i-1]);
ans %=998244353ll;
}
cout<<(ans+998244353ll)%998244353ll<<endl;
return 0;
}
kyushu1996