結果

問題 No.1096 Range Sums
コンテスト
ユーザー vjudge1
提出日時 2025-08-20 22:26:46
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 7 ms / 2,000 ms
+ 167µs
コード長 682 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,986 ms
コンパイル使用メモリ 330,848 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-14 06:38:28
合計ジャッジ時間 3,082 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:14:9: warning: ISO C++11 requires whitespace after the macro name
   14 | #define ios; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      |         ^~~

ソースコード

diff #
raw source code

//last dance go go
#include<bits/stdc++.h>
using namespace std;


#define NAME "unknown"
#define int int64_t
#define fi first
#define se second
#define ii pair<int,int>
#define iii pair<ii,int>
#define pb push_back
#define endl "\n"
#define ios; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 1e5 + 5;

int a[N], f[N];

vector<int> v;

signed main() {
    ios;

     if(ifstream (NAME".inp"))
    {
    freopen(NAME".inp","r",stdin);
   freopen(NAME".out","w",stdout);
    }
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1;i<=n;i++)
    {
        int x;
        cin >> x;
        ans += x * i * (n - i + 1);
    }
    cout << ans;
    return 0;
}
0