Răspuns:
#include<iostream>
#include<math.h>
using namespace std;
long n;
int x[1000],y[1000];
double dis2Puncte(int x,int y){
return sqrt(x*x+y*y);
}
long disMax(){
long i,ci;
double distantaMax=-1000000;
for(i=1;i<=n;i++)
if(dis2Puncte(x[i],y[i])>distantaMax){
distantaMax=dis2Puncte(x[i],y[i]);
ci=i; //Pozitia elementului cu distanta maxima
}
return ci;
}
int main(){
long i;
cout<<"n: "; cin>>n;
for(i=1;i<=n;i++) cin>>x[i]>>y[i];
cout<<"Punctul la distanta maxima de origine este: "<<disMax()<<" ("<<x[disMax()]<<", "<<y[disMax()]<<")";
}