結果

問題 No.8072 Sum of sqrt(x)
ユーザー 👑 希丝缇娜菲贝尔
提出日時 2025-11-04 23:16:01
言語 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  
実行時間 525 ms / 2,000 ms
+ 413µs
コード長 337 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,760 ms
コンパイル使用メモリ 168,032 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-16 07:48:22
合計ジャッジ時間 103,001 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <cmath>
#include <iostream>
using ld = long double;
using ll = long long;
int main() {
  int n; scanf("%d", &n);
  ld ans = 0, res = 0;
  for(;n --;) {
    ll x; scanf("%lld", &x);
    ld a = sqrt((ld)x);
    ld t = ans + a + res;
    res = a + res - (t - ans);
    ans = t;
    printf("%.16Lg\n", ans);
  }
}
0