답안 #84441

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
84441 2018-11-15T07:54:02 Z talip 생물 실험 (IZhO13_expgorl) C++14
0 / 100
1000 ms 688 KB
#include <bits/stdc++.h>
using namespace std;
//Yeter calis artik
//Scanf hurmetine. Pls.
char s[10002];
int x[10001]; int y[10001];
 
int main(){
	int lax, lay, gox, goy, n, k;
	long double mini=1.0E6, maxi=0, ans;
	scanf("%d %s %d %d %d %d",&k,s+1,&lax,&lay,&gox,&goy);	n=strlen(s+1);
	x[0]=gox-lax;	y[0]=goy-lay;
	for(int i=1;i<=n;i++){
		x[i]=x[i-1];		y[i]=y[i-1];
		switch(s[i]){
		    case 'L':
			x[i]--;
			break;
		case 'R':
			x[i]++;
			break;
		case 'F':
			y[i]++;
			break;
		case 'B':
			y[i]--;
			break;
		}
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<k;j++){
			ans=sqrtl(1LL*(x[i]+j*(x[n]-x[0]))*(x[i]+j*(x[n]-x[0]))+1LL*(y[i]+j*(y[n]-y[0]))*(y[i]+j*(y[n]-y[0])));
			if(mini>ans){
              	mini=ans;
            }
			if(ans>maxi){
              	maxi=ans;
            }
		}
	}
	printf("%.14Lf %.14Lf", mini, maxi);
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %s %d %d %d %d",&k,s+1,&lax,&lay,&gox,&goy); n=strlen(s+1);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 197 ms 376 KB Output is correct
2 Correct 249 ms 492 KB Output is correct
3 Correct 258 ms 492 KB Output is correct
4 Correct 277 ms 556 KB Output is correct
5 Correct 144 ms 556 KB Output is correct
6 Correct 212 ms 648 KB Output is correct
7 Correct 281 ms 688 KB Output is correct
8 Correct 314 ms 688 KB Output is correct
9 Execution timed out 1063 ms 688 KB Time limit exceeded
10 Halted 0 ms 0 KB -