結果

問題 No.1096 Range Sums
ユーザー nanophoto12nanophoto12
提出日時 2020-06-26 22:24:32
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 713 bytes
コンパイル時間 1,970 ms
コンパイル使用メモリ 200,940 KB
実行使用メモリ 4,876 KB
最終ジャッジ日時 2023-09-18 05:44:40
合計ジャッジ時間 2,955 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 36 ms
4,560 KB
testcase_11 AC 35 ms
4,568 KB
testcase_12 AC 36 ms
4,744 KB
testcase_13 AC 36 ms
4,612 KB
testcase_14 AC 36 ms
4,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0