結果

問題 No.1096 Range Sums
ユーザー kaseken
提出日時 2020-07-01 23:16:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 1,784 ms
コンパイル使用メモリ 193,340 KB
最終ジャッジ日時 2025-01-11 13:52:59
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
  int64_t N, ans = 0;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++)
  {
    ans += A.at(i) * (i + 1) * (N - i);
  }
  cout << ans << endl;
}
0