#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
using namespace std;
double n;
double a1,b1,a2,b2;
double dis1;
void dis(){
double a=(a1-a2)*(a1-a2);
double b=(b1-b2)*(b1-b1);
dis1=sqrt(a+b);
}
int main(){
cin>>n;
string s;
cin>>s;
int m=s.size();
cin>>a1>>b1>>a2>>b2;
double mn=INT_MAX,mx=-INT_MAX;
for(int i=1;i<=n;i++){
for(int k=0;k<m;k++){
if(s[k]=='L')
a1--;
if(s[k]=='R')
a1++;
if(s[k]=='F')
b1++;
if(s[k]=='B')
b1--;
/* if(s[k]=='I'){
cout<<fixed;
cout<<setprecision(12)<<mn<<' ';
cout<<setprecision(12)<<mx;
return 0;
}*/
dis();
if(mx<dis1)
mx=dis1;
if(mn>dis1)
mn=dis1;
}
}
cout<<fixed;
cout<<setprecision(12)<<mn<<' ';
cout<<setprecision(12)<<mx;
//cout<<fixed;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
157 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |