結果

問題 No.1096 Range Sums
ユーザー vjudge1
提出日時 2025-08-20 22:14:57
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 3,149 ms
コンパイル使用メモリ 276,284 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-20 22:15:01
合計ジャッジ時間 4,006 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n+1);
    for (int i = 1; i <= n; ++i) cin >> a[i];
    int res = 0;
    for (int i = 1; i <= n; ++i) {
        res += a[i] * i * (n - i + 1);
    }
    cout << res << '\n';
}
0