結果
| 問題 |
No.1096 Range Sums
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-08-20 22:26:46 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 682 bytes |
| コンパイル時間 | 3,158 ms |
| コンパイル使用メモリ | 275,632 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-20 22:26:50 |
| 合計ジャッジ時間 | 3,795 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
コンパイルメッセージ
main.cpp:14:9: warning: ISO C++11 requires whitespace after the macro name
14 | #define ios; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
| ^~~
main.cpp: In function ‘int main()’:
main.cpp:27:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | freopen(NAME".inp","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:28:11: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | freopen(NAME".out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
//last dance go go
#include<bits/stdc++.h>
using namespace std;
#define NAME "unknown"
#define int int64_t
#define fi first
#define se second
#define ii pair<int,int>
#define iii pair<ii,int>
#define pb push_back
#define endl "\n"
#define ios; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int N = 1e5 + 5;
int a[N], f[N];
vector<int> v;
signed main() {
ios;
if(ifstream (NAME".inp"))
{
freopen(NAME".inp","r",stdin);
freopen(NAME".out","w",stdout);
}
int n;
cin >> n;
int ans = 0;
for(int i = 1;i<=n;i++)
{
int x;
cin >> x;
ans += x * i * (n - i + 1);
}
cout << ans;
return 0;
}
vjudge1