Type: Default 1000ms 512MiB

平方根

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

给定一个浮点数 aa,求它的算术平方根。

输入格式

输入的第一行包含一个浮点数 aa(0≤a≤1090 \le a \le 10^9)。

输出格式

输出一个浮点数 a\sqrt a。

设你的输出为 pp,标准答案为 qq。当

∣p−q∣≤10−9max⁡(∣q∣,1)|p-q| \le 10^{-9}\max(|q|,1)

时,答案会被接受。这等价于绝对误差或相对误差不超过 10−910^{-9}。

样例

2.0
1.41421356237309510000

提示

默认的浮点输出精度可能不足,请输出足够多的有效数字。

参考实现

#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define sc second
#define ll long long
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	double x;
	cin >> x;
	cout << fixed << setprecision(12) << sqrt(x);
	return 0;
}

2026新生赛热身赛

Not Attended
Status
Done
Rule
XCPC
Problem
9
Start at
2026-8-29 10:45
End at
2026-9-13 10:45
Duration
360 hour(s)
Host
Partic.
50