結果
| 問題 | 
                            No.1096 Range Sums
                             | 
                    
| コンテスト | |
| ユーザー | 
                             risujiroh
                         | 
                    
| 提出日時 | 2020-06-26 21:22:09 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 34 ms / 2,000 ms | 
| コード長 | 344 bytes | 
| コンパイル時間 | 1,875 ms | 
| コンパイル使用メモリ | 192,760 KB | 
| 最終ジャッジ日時 | 2025-01-11 10:42:38 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    res += a * (i + 1) * (n - i);
  }
  cout << res << '\n';
}
            
            
            
        
            
risujiroh