結果
問題 |
No.1096 Range Sums
|
ユーザー |
|
提出日時 | 2020-06-26 21:33:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 167,780 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 21:33:14 |
合計ジャッジ時間 | 2,309 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; typedef long long ll; typedef long double ld; const int inf=1e9+7; const ll longinf=1LL<<60; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) #define F first #define S second constexpr char ln = '\n'; const int mx=200010; const ll mod=1e9+7; int main(){ ll n; cin >> n; vector<ll> a(n); rep(i,n){ cin >> a[i]; } ll ans = 0; rep(i,n){ ans += a[i]*(i+1)*(n-i); } cout << ans << ln; return 0; }