結果
| 問題 |
No.1096 Range Sums
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-26 23:16:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 517 bytes |
| コンパイル時間 | 2,038 ms |
| コンパイル使用メモリ | 196,392 KB |
| 最終ジャッジ日時 | 2025-01-11 12:11:04 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 TLE * 5 |
ソースコード
#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;
}