Submission #944520

#TimeUsernameProblemLanguageResultExecution timeMemory
944520rainboy제곱근 구하기 2 (gs13068_sqrt2)C11
Compilation error
0 ms0 KiB
#include <math.h> #include <stdio.h> long long abs_(long long a) { return a > 0 ? a : -a; } int main() { long long n, r; scanf("%lld", &n); r = sqrt(n); while (abs_(r * r - n) > abs_((r + 1) * (r + 1) - n)) r++; while (abs_(r * r - n) > abs_((r - 1) * (r - 1) - n)) r--; printf("%f\n", (double) r / 2 + (double) n / r / 2); return 0; }

Compilation message (stderr)

sqrt2.c: In function 'main':
sqrt2.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%lld", &n);
      |  ^~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccoJK3Y6.o: in function `main':
sqrt2.c:(.text.startup+0x114): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status