제출 #944515

#제출 시각아이디문제언어결과실행 시간메모리
944515rainboy제곱근 구하기 1 (gs13068_sqrt1)C++17
1 / 1
1 ms604 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...