結果

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

ソースコード

diff #

#include <iostream>
using namespace std;

const int MAXN = 2e5;

int n;
int arr[MAXN + 5];

void solve()
{
    cin >> n;

    long long sum = 0;
    for (int i = 1; i <= n; i++) {
        long long x;
        cin >> x;
        sum += x * i * (n - i + 1);
    }

    cout << sum << '\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    solve();

    return 0;
}
0