結果

問題 No.8072 Sum of sqrt(x)
ユーザー trineutron
提出日時 2020-06-05 18:51:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 443 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 88,808 KB
最終ジャッジ日時 2025-01-10 21:45:07
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    long double 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 << s << "\n";
    }
}
0