Submission #5336

#TimeUsernameProblemLanguageResultExecution timeMemory
5336ansol4328Experiments with Gorlum (IZhO13_expgorl)C++98
0 / 100
0 ms1108 KiB
#include<stdio.h>
#include<string.h>
#include<math.h>

char a[10000];

int main()
{
    int n, lx, ly, x, y;
    int dy[4]={-1,0,1,0};
    int dx[4]={0,1,0,-1};
    int i, k;
    double max, min, h;
    scanf("%d",&n);
    scanf(" %s",&a);
    scanf("%d %d",&lx,&ly);
    scanf("%d %d",&x,&y);
    max=min=hypot(x-lx,y-ly);
    for(i=0 ; i<strlen(a) ; i++)
    {
        if(a[i]=='L') k=3;
        if(a[i]=='R') k=1;
        if(a[i]=='F') k=0;
        if(a[i]=='B') k=2;
        if(a[i]=='I') break;
        x+=dx[k], y+=dy[k];
        h=hypot(x-lx,y-ly);
        if(max<h) max=h;
        if(min>h) min=h;
    }
    printf("%.12lf %.12lf",min,max);
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...