結果
問題 |
No.1096 Range Sums
|
ユーザー |
![]() |
提出日時 | 2025-08-20 22:15:47 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 681 bytes |
コンパイル時間 | 2,913 ms |
コンパイル使用メモリ | 278,068 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-20 22:15:52 |
合計ジャッジ時間 | 4,134 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
main.cpp:17:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 17 | main() | ^~~~
ソースコード
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define fi first #define se second #define pii pair<ll, ll> #define mpii map<ll, ll> #define vall(a) (a).begin(), (a).end() #define all(a, n) a + 1, a + 1 + n #define sze(a) (ll) a.size() #define gcd __gcd using namespace std; const ll INF = 1e18; const ll MOD = 1e9 + 7; const ll MAXN = 1e5 + 10; main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ll n; cin >> n; vector<ll> a(n + 1); for (ll i = 1; i <= n; i++) cin >> a[i]; ll res = 0; for (ll i = 1; i <= n; i++) { res += a[i] * i * (n - i + 1) * 1LL; } cout << res; return 0; }