結果
| 問題 |
No.1096 Range Sums
|
| コンテスト | |
| ユーザー |
Dente
|
| 提出日時 | 2020-06-26 22:03:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 490 bytes |
| コンパイル時間 | 1,797 ms |
| コンパイル使用メモリ | 192,008 KB |
| 最終ジャッジ日時 | 2025-01-11 11:29:00 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
signed main() {
int n;
cin >> n;
ll a[n];
rep(i, n) {
cin >> a[i];
}
ll ans = 0;
rep(i, n) {
ans += a[i] * (i + 1) * (n - i);
}
cout << ans << endl;
return 0;
}
Dente