結果

問題 No.1096 Range Sums
コンテスト
ユーザー GulTion
提出日時 2020-06-26 23:16:11
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 517 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,184 ms
コンパイル使用メモリ 182,588 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2026-03-26 06:19:52
合計ジャッジ時間 16,745 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
int s(vector<int> arr,int i, int j){
	int sum=0;
	for(int k=i;k<=j;k++){
		sum+=arr[k];
	}
	return sum;
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("inp.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif

	int n,i,j;
	int total=0;
	vector<int> arr;
	cin>>n;
	for(i=0;i<=n;i++){
		int ele;
		cin>>ele;
		arr.push_back(ele);
	}
	for(i=1;i<=n;++i)
	{
		for(int j=1;j<=n;++j)
		{
			if(i<=j)
			{
				total+=s(arr,i-1,j-1);
			}
		}

	}
	cout<<total;

	

	return 0;
}
0