結果

問題 No.2235 Line Up Colored Balls
ユーザー t98slider
提出日時 2023-02-21 15:33:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 438 bytes
コンパイル時間 1,692 ms
コンパイル使用メモリ 168,600 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 07:18:53
合計ジャッジ時間 3,428 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    
    vector<ll> x(n);
    for(auto &v : x) cin >> v;
    ll s = accumulate(x.begin(), x.end(), 0ll);
    ll s1 = accumulate(x.begin(), x.end(), 0ll, [&](ll lhs, ll rhs){return lhs + rhs * (s - rhs);});
    
    cout << fixed << setprecision(15) << (1 + double(s1) / s) << '\n';
}
0