|
|
вернуться в форумwhy WA text 3???help me mycode: #include<stdio.h> #include<math.h> #include<algorithm> using namespace std; #define N 10002 struct node { double x,y; int num; }point[N]; int n; int cmp(node a,node b) { double pp=atan2(a.y-point[0].y,a.x-point[0].x); double qq=atan2(b.y-point[0].y,b.x-point[0].x); //double pp=(a.x-point[0].x)*(b.y-point[0].y)-(a.y-point[0].y)*(b.x-point[0].x); return pp>qq; } int main() { scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%lf%lf",&point[i].x,&point[i].y); point[i].num=i+1; } int pos=0; /*for(int i=1;i<n;i++) { if(point[i].x<point[pos].x||(point[i].x==point[pos].x)&&point[i].y<point[pos].y) pos=i; } swap(point[0],point[pos]);*/ sort(point+1,point+n,cmp); printf("%d %d\n",point[0].num ,point[n/2].num); return 0; } what it`s function in /* */ |
|
|