結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define maxn 200005

int n;
int a[maxn];
ll sum;

int main()
{
   

    cin >> n;

    sum = 0;

    for (int i = 1; i <= n; i++) cin >> a[i];

    for (int i = 1; i <= n; i++){
        sum += (ll)(1LL*a[i]*i*(n-i+1));
    }

    cout << sum;

    return 0;
}
0