답안 #339263

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
339263 2020-12-25T02:46:02 Z beksultan04 생물 실험 (IZhO13_expgorl) C++14
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scan1(a) scanf("%lld",&a);
#define scan2(a,b) scanf("%lld %lld",&a, &b);
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
const int N = 1e5+12,INF=1e9+7;

long double disting(double x,double y,double x1,double y1){
    ret sqrt(((x-x1)*(x-x1))+((y-y1)+(y-y1)));
}

main(){
    long double k,i,j,mx,mn,l=0,r=0,x1,y1,x,y;
    string s;
    cin>>k>>s>>x>>y>>x1>>y1;

    mn = disting(x,y,x1,y1);
    mx = disting(x,y,x1,y1);
    for (i=0;i<s.size();++i){
        if (s[i] == 'L')l--;
        if (s[i] == 'R')l++;
        if (s[i] == 'F')r++;
        if (s[i] == 'B')r--;
    }
    l *= k-1;
    r *= k-1;
    x1 += l;
    y1 += r;
    mn = min(mn,disting(x,y,x1,y1));
    mx = max(mx,disting(x,y,x1,y1));
    for (i=0;i<s.size();++i){
        if (s[i] == 'L'){
            x1--;
        }
        if (s[i] == 'R'){
            x1++;
        }
        if (s[i] == 'F'){
            y1++;
        }
        if (s[i] == 'B'){
            y1--;
        }
        mn = min(mn,disting(x,y,x1,y1));
        mx = max(mx,disting(x,y,x1,y1));

    }
    cout <<fixed <<setprecision(9)<<mn<<" "<<mx;
}







Compilation message

expgorl.cpp:25:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   25 | main(){
      |      ^
expgorl.cpp: In function 'int main()':
expgorl.cpp:26:21: warning: unused variable 'j' [-Wunused-variable]
   26 |     long double k,i,j,mx,mn,l=0,r=0,x1,y1,x,y;
      |                     ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -