結果

問題 No.8072 Sum of sqrt(x)
ユーザー trineutron
提出日時 2020-06-05 19:04:08
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1,271 ms / 2,000 ms
コード長 432 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,206 ms
コンパイル使用メモリ 84,924 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-10 12:25:27
合計ジャッジ時間 114,473 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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(17);
    int n;
    std::cin >> n;
    double s = 0, t, r = 0;
    for (int i = 0; i < n; i++) {
        double x;
        std::cin >> x;
        x = sqrt(x) + r;
        t = s + x;
        r = x - (t - s);
        s = t;
        std::cout << s << "\n";
    }
}
0