Submission #944515

# Submission time Handle Problem Language Result Execution time Memory
944515 2024-03-12T20:58:49 Z rainboy 제곱근 구하기 1 (gs13068_sqrt1) C++17
1 / 1
1 ms 604 KB
#include <math.h>
#include <stdio.h>

int main() {
	long long n;
	int r;

	scanf("%lld", &n), r = sqrt(n);
	while ((long long) (r + 1) * (r + 1) <= n)
		r++;
	while ((long long) r * r > n)
		r--;
	printf("%f\n", r + (double) (n - (long long) r * r) / (r * 2 + 1));
	return 0;
}

Compilation message

sqrt1.cpp: In function 'int main()':
sqrt1.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%lld", &n), r = sqrt(n);
      |  ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 416 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 416 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct