結果
問題 |
No.1096 Range Sums
|
ユーザー |
![]() |
提出日時 | 2025-08-20 22:12:41 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 459 bytes |
コンパイル時間 | 3,067 ms |
コンパイル使用メモリ | 274,156 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-08-20 22:12:46 |
合計ジャッジ時間 | 4,753 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 RE * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:24: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | freopen("temp.inp", "r", stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:12:24: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | freopen("temp.out", "w", stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> #define int long long #define endl "\n" #define MAXN 100005 #define inf 1e18 using namespace std; int a[MAXN], f[MAXN], g[MAXN]; int n, sum=0; signed main() { if (fopen("temp.inp", "r")){ freopen("temp.inp", "r", stdin); freopen("temp.out", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin>>n; for (int i=1; i<=n; i++){ cin>>a[i]; sum+=a[i]*(n-i+1)*(i); } cout<<sum; }