답안 #88973

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

using namespace std;

int main()
{
    //freopen("input.txt","r",expgorl.in);
    //freopen("output.txt","w",expgorl.out);
    string t,s;
    long long int k,lx,ly,gx,gy,i,j,m,n;

    cin >> k;
    cin >> s;
    cin >> lx >> ly;
    cin >> gx >> gy;
    long long int x=(lx-gx)*(lx-gx),y=(ly-gy)*(ly-gy);
    long long int dis=sqrt(x+y);
    long long int mx=dis,mn=dis;
    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 << mn << mx;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:19:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i=0;i<s.size();i++)
              ~^~~~~~~~~
expgorl.cpp:10:35: warning: unused variable 'j' [-Wunused-variable]
     long long int k,lx,ly,gx,gy,i,j,m,n;
                                   ^
expgorl.cpp:10:37: warning: unused variable 'm' [-Wunused-variable]
     long long int k,lx,ly,gx,gy,i,j,m,n;
                                     ^
expgorl.cpp:10:39: warning: unused variable 'n' [-Wunused-variable]
     long long int k,lx,ly,gx,gy,i,j,m,n;
                                       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -