#include <bits/stdc++.h>
using namespace std;
int main()
{
double k,x1,x2,y1,y2,mx,mn,t;
string s;
cin>>k;
cin>>s;
cin>>x1>>y1;
cin>>x2>>y2;
mx=sqrt(abs(x1-x2)*abs(x1-x2)+abs(y1-y2)*abs(y1-y2));
mn=mx;
//for(double i=0;i<k;i++)
for(double j=0;j<s.size();j++){
if(s[j]=='L')
x2=x2-1;
if(s[j]=='R')
x2=x2+1;
if(s[j]=='F')
y2=y2+1;
if(s[j]=='B')
y2=y2-1;
t=sqrt(abs(x1-x2)*abs(x1-x2)+abs(y1-y2)*abs(y1-y2));
mx=max(mx,t);
mn=min(mn,t);
mx=max(mx,t*k);
mn=min(mn,t*k);
}
cout<<fixed<<setprecision(9)<<mn<<' '<<fixed<<setprecision(9)<<mx;
return 0;
}
Compilation message
expgorl.cpp: In function 'int main()':
expgorl.cpp:27:8: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if(s[j]=='B')
^~
expgorl.cpp:30:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
t=sqrt(abs(x1-x2)*abs(x1-x2)+abs(y1-y2)*abs(y1-y2));
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |