結果

問題 No.1096 Range Sums
ユーザー vjudge1
提出日時 2025-08-20 22:05:12
言語 C++17(gnu拡張)
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 1,944 ms
コンパイル使用メモリ 194,500 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-20 22:05:15
合計ジャッジ時間 3,001 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:2: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    5 |  main()
      |  ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[200005];
 main()
{
    int n;
    cin>>n;
    int dem=0;
    for (int i=1;i<=n;i++) {
        cin>>a[i];
    }
    int sl=1;
    for (int i=1;i<=n;i++) {
        dem+=a[i]*(n-sl+1)*sl;
        sl++;
    }
    cout<<dem;
    return 0;
}
0