結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
using namespace std;
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, tong = 0, a[200005];
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++)
    {
        tong += a[i] * (n - i + 1) * i;
    }
    cout << tong;
}
0