답안 #1009081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1009081 2024-06-27T08:35:25 Z tarpent 생물 실험 (IZhO13_expgorl) C++14
0 / 100
172 ms 35768 KB
#include<bits/stdc++.h>
using namespace std;
long long n,gx,gy,lx,ly;
string pu,u;
long double mi,ma,tr;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	cin>>n;
	cin>>pu;
	for(int i = 0; i<n; i++){
		u+=pu;
	}
	cin>>lx>>ly>>gx>>gy;
	mi= LLONG_MAX;
	ma=0;
	for(auto e: u){
		if(e=='L'){
			gx-=1;
		}
		else if(e=='R'){
			gx+=1;
		}
		else if(e=='F'){
			gy+=1;
		}
		else if(e=='B'){
			gy-=1;
		}
		else if(e=='I'){
			continue;
		}
		
		tr=sqrt(((abs(lx-gx))^2) +(abs(ly-gy))^2);
		if(tr>ma) ma = tr;
		if(tr<mi) mi = tr;
	}
	cout<<fixed;
	
	cout<<setprecision(12);
	cout<<mi<<' '<<ma;
	
	
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:35:28: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   35 |   tr=sqrt(((abs(lx-gx))^2) +(abs(ly-gy))^2);
      |           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 172 ms 35768 KB Output isn't correct
2 Halted 0 ms 0 KB -