結果

問題 No.1096 Range Sums
ユーザー totori_nyaatotori_nyaa
提出日時 2020-06-26 21:45:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 1,836 ms
コンパイル使用メモリ 193,508 KB
最終ジャッジ日時 2025-01-11 11:11:36
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};
long double eps = 1e-6;
long double pi = acos(-1);


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n;
    cin>>n;
    ll ans = 0;
    for(ll i=0;i<n;i++){
        ll a; cin>>a;
        ans += a * (i+1) * (n-i);
    }
    cout << ans << endl;
}
0