#include <bits/stdc++.h>
#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair
using namespace std;
typedef long long ll;
const int inf = (int)1e9 + 7;
const int N = (int)1e6 + 7;
double dist (int x,int y,int l,int r) {
return sqrt((x - l) * (x - l) + (y - r) * (y - r));
}
int k;
string a;
int x,y,l,r;
double mn = inf,mx = 0;
main () {
cin >> k;
cin >> a;
cin >> x >> y;
cin >> l >> r;
for (int i = 1; i <= k; i ++) {
for (int j = 0; j < a.size(); j ++) {
if (a[j] == 'L')
l --;
if (a[j] == 'R')
l ++;
if (a[j] == 'F')
r ++;
if (a[j] == 'B')
r --;
mn = min(mn,dist(x,y,l,r));
mx = max(mx,dist(x,y,l,r));
}
}
cout << fixed << setprecision(12) << mn << " " << mx << endl;
}
Compilation message
expgorl.cpp:25:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main () {
^
expgorl.cpp: In function 'int main()':
expgorl.cpp:33:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int j = 0; j < a.size(); j ++) {
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
549 ms |
2028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |