|
|
вернуться в форумWA on Test#7 Please HELP!!!! The code is below: WHY WA :-( #include <stdio.h> struct point { long x; long y; int id; }; void Sort (point points[], int n) { for (int i = 0; i < n; i++) { for (int j = 0; j < n - i - 1; j++) { double r1 = points[j+1].y * points[j].x; double r2 = points[j].y * points[j+1].x; if (r1 < r2) { point t = points[j]; points[j] = points[j+1]; points[j+1] = t; } } } } void main() { int N = 0; scanf ("%d", &N); const int MAX = 10000; point points[MAX] = {0}; for (int i = 0; i < N; i++) { scanf ("%ld%ld", &points[i].x, &points[i].y); points[i].id = i + 1; } Sort (points, N); printf ("%d %d", points[0].id, points[N/2].id); } |
|
|