답안 #89029

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89029 2018-12-10T08:35:14 Z mate 생물 실험 (IZhO13_expgorl) C++14
0 / 100
2 ms 256 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{

    string t,s;
    double k,lx,ly,gx,gy,i,j,m,n;

    cin >> k;
    cin >> s;
    cin >> lx >> ly;
    cin >> gx >> gy;
    double x=(lx-gx)*(lx-gx),y=(ly-gy)*(ly-gy);
    double dis=sqrt(x+y);
    double mx=dis,mn=dis;
    for (j=0;j<n;j++)
    for (i=0;i<s.size();i++)
    {
        if (s[i]=='L') gx=gx-1;
        if (s[i]=='R') gx=gx+1;
        if (s[i]=='F') gy=gy+1;
        if (s[i]=='B') gy=gy-1;
        x=(lx-gx)*(lx-gx);
        y=(ly-gy)*(ly-gy);
        dis=sqrt(x+y);
        mx=max(mx,dis);
        mn=min(mn,dis);
    }
    cout<<fixed<<setprecision(9)<<mn<<' '<<fixed<<setprecision(9)<<mx;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:9:30: warning: unused variable 'm' [-Wunused-variable]
     double k,lx,ly,gx,gy,i,j,m,n;
                              ^
expgorl.cpp:18:15: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
     for (j=0;j<n;j++)
              ~^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -