답안 #940687

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940687 2024-03-07T13:26:10 Z sleepntsheep Mobile (BOI12_mobile) C
컴파일 오류
0 ms 0 KB
#include<stdio.h>
#include<math.h>
#define N 1000000



int n, L;
double x[N], y[N];

int main()
{
    scanf("%d%d",&n,&L);
    for(int i=0;i<n;++i)scanf("%lf%lf",x+i,y+i);
    double l=0,r=1e9;
    for (int iter=160;iter--;)
    {
        double m=(l+r)/2,rr=0;
        for(int i=0;i<n;++i)
        {
            if(m*m>=y[i]*y[i])
            {
                double dx=sqrt(m*m-y[i]*y[i]);
                if(x[i]-dx<=rr)
                    if(x[i]+dx>rr)rr=x[i]+dx;
            }
        }

        if(rr>=L) r=m;
        else l=m;
    }
    printf("%.6lf",r);
    
}

Compilation message

mobile.c: In function 'main':
mobile.c:12:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d%d",&n,&L);
      |     ^~~~~~~~~~~~~~~~~~~
mobile.c:13:25: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     for(int i=0;i<n;++i)scanf("%lf%lf",x+i,y+i);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc3JZb4G.o: in function `main':
mobile.c:(.text.startup+0x1d4): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status