結果

問題 No.8072 Sum of sqrt(x)
ユーザー rabimea
提出日時 2023-10-27 20:01:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
OLE  
実行時間 -
コード長 324 bytes
コンパイル時間 2,097 ms
コンパイル使用メモリ 193,308 KB
最終ジャッジ日時 2025-02-17 14:08:43
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 OLE * 5 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ld = long double;

int main() {
	ios::sync_with_stdio(0);

	int n; cin >> n;
	
	ld sum = 0, c = 0;
	while(n --) {
		ld x; cin >> x;
		x = sqrt(x);
		
		x = x + c;
		ld t = sum + x;
		c = t - sum - x;
		sum = t;
		
		cout << fixed << setprecision(18) << sum << '\n';
	}
}
0