제출 #84429

#제출 시각아이디문제언어결과실행 시간메모리
84429farukkastamonuda생물 실험 (IZhO13_expgorl)C++14
0 / 100
1068 ms632 KiB
#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;
lo int k,lx,ly,gx,gy;
char s[li];
double mx,mn=inf;
double dis(lo int a,lo 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("%lld",&k);
	scanf("%s",s+1);
	lo int t=strlen(s+1);
	scanf("%lld %lld %lld %lld",&lx,&ly,&gx,&gy);
	mx=max(mx,dis(gx,gy));
	mn=min(mn,dis(gx,gy));
	for(int i=1;i<=k;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;
}

컴파일 시 표준 에러 (stderr) 메시지

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("%lld",&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("%lld %lld %lld %lld",&lx,&ly,&gx,&gy);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...