結果
| 問題 |
No.2111 Sum of Diff
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-28 22:51:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 470 bytes |
| コンパイル時間 | 399 ms |
| コンパイル使用メモリ | 37,120 KB |
| 最終ジャッジ日時 | 2025-02-08 14:51:40 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d", &A);
| ~~~~~^~~~~~~~~~
ソースコード
#include<cstdio>
#include<atcoder/modint>
using namespace std;
using namespace atcoder;
using Mint = modint998244353;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main(){
int N;
scanf("%d", &N);
Mint two[N];
two[0] = 1;
rep(i, N-1) two[i+1] = two[i]*2;
Mint answer{0};
rep(i, N){
int A;
scanf("%d", &A);
answer += Mint::raw(A)*(two[N-1-i] - two[i]);
}
printf("%u\n", answer.val());
return 0;
}