結果
| 問題 | No.1096 Range Sums |
| コンテスト | |
| ユーザー |
nanophoto12
|
| 提出日時 | 2020-06-26 22:24:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 713 bytes |
| 記録 | |
| コンパイル時間 | 2,000 ms |
| コンパイル使用メモリ | 194,036 KB |
| 最終ジャッジ日時 | 2025-01-11 11:46:52 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
#define M_PI 3.14159265358979323846 // pi
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;
#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)
using namespace std;
static const ll INF = 1e15;
const ll mod = 1000000007;
int main() {
int n;
cin >> n;
vector<ll> vs(n);
rep(i, n) cin >> vs[i];
ll sum = 0;
for (int i = 0; i < n; i++) {
ll left = i + 1;
ll right = n - i;
ll token = left* right* vs[i];
sum += token;
}
cout << sum << endl;
return 0;
}
nanophoto12