結果
問題 | No.1096 Range Sums |
ユーザー |
![]() |
提出日時 | 2020-08-19 16:51:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 453 bytes |
コンパイル時間 | 2,198 ms |
コンパイル使用メモリ | 193,128 KB |
最終ジャッジ日時 | 2025-01-13 03:51:49 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define rep(i,n) for(int i = 0; i < n; i++)using ll = long long;using graph = vector<vector<int>>;const ll mod = 1000000007;const int INF = 1001001001;int main(){ll n; cin >> n;vector<ll> a(n);for(ll i = 0; i < n; i++) cin >> a[i];ll ans = 0;ll cnt = n;for(ll i = 0; i < n; i++){ans += a[i] * cnt;cnt = (n-1-i) * (i+2);}cout << ans << endl;}