3183. 坐标排序

typedef struct {
int x,y;
} Point;


//********** Specification of SortPoints **********
void SortPoints(Point *p, int n);
/* PreCondition:
p points to an array with n coordinate points
PostCondition:
array is sorted satisfying to the specification
*/

/***************************************************************/
/*                                                             */
/*  DON'T MODIFY main function ANYWAY!                         */
/*                                                             */
/***************************************************************/
#include <stdio.h>
#include <stdlib.h>
#define N 100
typedef struct {
int x,y;
} Point;
/********** Specification of SortPoints **********/
void SortPoints(Point *p, int n)
/* PreCondition:
p points to an array with n coordinate points
PostCondition:
array is sorted satisfying to the specification
*/
}
/***************************************************************/
int main()
{
Point a[N];
int n,i,t,cas;
scanf("%d",&cas);
for(t=0; t<cas; t++)
{
scanf("%d",&n);
for (i=0; i<n; i++) scanf("%d%d",&a[i].x,&a[i].y);
/***** function SortPoints is called here *****/
SortPoints(a,n);
/****************************************/
printf("case #%d:\n",t);
for (i=0; i<n; i++) printf("(%d,%d)%c",a[i].x,a[i].y,i<n-1?' ':'\n');
}
return 0;
}


110 人解决，115 人已尝试。

129 份提交通过，共有 299 份提交。

2.4 EMB 奖励。