1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x=41.404974;
double y=19.705841;
string city1,city,city2,city3;
double x1,y1,x2,x3,y2,y3,d2,d3;
double d1,minn;
int i,j;
cin>>city1>>x1>>y1;
cin>>city2>>x2>>y2;
cin>>city3>>x3>>y3;
double dx=x1-x;
double dy=y1-y;
double dx2=x2-x;
double dy2=y2-y;
double dx3=x3-x;
double dy3=y3-y;
d1=sqrt(pow(dx,2)+pow(dy,2));
d2=sqrt(pow(dx2,2)+pow(dy2,2));
d3=sqrt(pow(dx3,2)+pow(dy3,2));
if (d1<=d2){
minn=d1;
city=city1;
}
else if (d2<d1)
{
minn=d2;
city=city2;
}
if (d3<=minn)
{
minn=d3;
city=city3;
}
cout<<city;
return 0;
}
|