結果

問題 No.1096 Range Sums
ユーザー snrnsidysnrnsidy
提出日時 2021-05-13 03:37:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 2,406 ms
コンパイル使用メモリ 200,928 KB
実行使用メモリ 6,100 KB
最終ジャッジ日時 2023-10-24 21:38:53
合計ジャッジ時間 3,337 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,688 KB
testcase_01 AC 3 ms
5,688 KB
testcase_02 AC 3 ms
5,628 KB
testcase_03 AC 2 ms
5,628 KB
testcase_04 AC 3 ms
5,688 KB
testcase_05 AC 3 ms
5,688 KB
testcase_06 AC 2 ms
5,628 KB
testcase_07 AC 3 ms
5,688 KB
testcase_08 AC 2 ms
5,688 KB
testcase_09 AC 2 ms
5,688 KB
testcase_10 AC 15 ms
6,100 KB
testcase_11 AC 15 ms
6,100 KB
testcase_12 AC 15 ms
6,100 KB
testcase_13 AC 15 ms
6,100 KB
testcase_14 AC 15 ms
6,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

long long int A[200005];
long long int psum[200005];

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	long long int res = 0;

	cin >> N;

	for (int i = 1; i <= N; i++)
	{
		cin >> A[i];
	}

	for (int i = 1; i <= N; i++)
	{
		long long int L = i;
		long long int R = (N - i + 1);
		L *= R;
		L *= A[i];
		res += L;
	}

	cout << res << '\n';

	return 0;
}
0