답안 #84435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
84435 2018-11-15T07:41:50 Z farukkastamonuda 생물 실험 (IZhO13_expgorl) C++14
0 / 100
118 ms 376 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
using namespace std;
int k,lx,ly,gx,gy;
char s[li];
double mx,mn=inf;
double dis(int a,int b){
	double aa=a,bb=b;
	double cc=lx,dd=ly;
	return sqrt(abs(aa-cc)*abs(aa-cc)+abs(bb-dd)*abs(bb-dd));
}
int main(){
	scanf("%d",&k);
	scanf("%s",s+1);
	int t=strlen(s+1);
	scanf("%d %d %d %d",&lx,&ly,&gx,&gy);
	mx=max(mx,dis(gx,gy));
	mn=min(mn,dis(gx,gy));
	for(int i=1;i<=min(k,10000);i++){
		for(int j=1;j<t;j++){
			if(s[j]=='L'){
				gx--;
			}
			if(s[j]=='R'){
				gx++;
			}
			if(s[j]=='F'){
				gy++;
			}
			if(s[j]=='B'){
				gy--;
			}
			mx=max(mx,dis(gx,gy));
			mn=min(mn,dis(gx,gy));
		}
	}
	printf("%.12lf %.12lf\n",mn,mx);
	return 0;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&k);
  ~~~~~^~~~~~~~~
expgorl.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",s+1);
  ~~~~~^~~~~~~~~~
expgorl.cpp:23:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d %d",&lx,&ly,&gx,&gy);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 118 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -