【2019暑期】【PAT乙级】1082 射击比赛 (20 分)

开平方是 sqrt

简单题,map都用不上,,

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include  

using namespace std;

double maxx,minn = 10000;
string one,last;
int n;
	
int main(){
	
	cin >> n;
	for(int i=0; i> a >> x >> y;
		sum = sqrt(pow(x,2) + pow(y,2));
		if(sum > maxx) {
			last = a;
			maxx = sum;
		}
		if(sum < minn) {
			one = a;
			minn = sum;
		}
	}
	cout << one << " " << last << endl;
	return 0;
} 

你可能感兴趣的:(pat,2019暑期)