結果

問題 No.8072 Sum of sqrt(x)
ユーザー trineutron
提出日時 2020-06-10 21:27:36
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 856 ms / 2,000 ms
+ 840µs
コード長 456 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 492 ms
コンパイル使用メモリ 105,020 KB
実行使用メモリ 9,904 KB
最終ジャッジ日時 2026-11-23 00:11:26
合計ジャッジ時間 49,014 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <iomanip>
#include <cmath>

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(18);
    int n;
    std::cin >> n;
    __float128 s = 0, t, r = 0;
    for (int i = 0; i < n; i++) {
        long double x;
        std::cin >> x;
        x = sqrtl(x) + r;
        t = s + x;
        r = x - (t - s);
        s = t;
        std::cout << (long double) s << "\n";
    }
}
0