結果

問題 No.3072 Sum of sqrt(x)
ユーザー rabimearabimea
提出日時 2023-10-27 20:31:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,487 ms / 2,000 ms
コード長 414 bytes
コンパイル時間 3,144 ms
コンパイル使用メモリ 198,928 KB
実行使用メモリ 5,068 KB
最終ジャッジ日時 2023-10-27 20:34:01
合計ジャッジ時間 161,974 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,996 KB
testcase_01 AC 2 ms
5,056 KB
testcase_02 AC 2 ms
5,000 KB
testcase_03 AC 2 ms
5,056 KB
testcase_04 AC 2 ms
5,056 KB
testcase_05 AC 2 ms
5,004 KB
testcase_06 AC 2 ms
5,000 KB
testcase_07 AC 1,397 ms
5,056 KB
testcase_08 AC 497 ms
4,376 KB
testcase_09 AC 704 ms
4,376 KB
testcase_10 AC 947 ms
4,376 KB
testcase_11 AC 1,318 ms
4,376 KB
testcase_12 AC 1,469 ms
4,376 KB
testcase_13 AC 1,487 ms
4,376 KB
testcase_14 AC 1,476 ms
4,380 KB
testcase_15 AC 1,447 ms
4,380 KB
testcase_16 AC 1,447 ms
4,380 KB
testcase_17 AC 1,465 ms
4,380 KB
testcase_18 AC 1,441 ms
5,008 KB
testcase_19 AC 1,484 ms
5,008 KB
testcase_20 AC 1,478 ms
5,008 KB
testcase_21 AC 1,446 ms
5,012 KB
testcase_22 AC 1,473 ms
5,012 KB
testcase_23 AC 1,465 ms
5,068 KB
testcase_24 AC 1,451 ms
5,068 KB
testcase_25 AC 1,453 ms
5,068 KB
testcase_26 AC 1,479 ms
5,012 KB
testcase_27 AC 1,369 ms
5,012 KB
testcase_28 AC 1,402 ms
5,068 KB
testcase_29 AC 1,431 ms
5,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ld = double;
using ll = long long;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout.precision(18);

	int n; cin >> n;
	
	ld sum = 0, c = 0;
	while(n --) {
		ll _x; // scanf("%lld", &_x);
		cin >> _x;
		ld x = sqrt(ld(_x));
		
		x = x + c;
		ld t = sum + x;
		c = x - (t - sum);
		sum = t;
		
		//~ printf("%.18Lf\n", sum);
		cout << sum << '\n';
	}
}
0