正文

test2006-07-21 14:21:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/elva6401/16733.html

分享到:

// a.cpp : Defines the entry point for the console application.// #include "stdafx.h" #include <iostream.h>#include <stdlib.h> //int X[10000],Y[10000],n; /*struct P{ int x1; int x2;}a[10000]; int comp(const void *a,const void *b){ struct P *x=(P *)a; struct P *y=(P *)b; if(x->x1>y->x1)  return 0; else if(x->x1<y->x1)  return 1; else {  if(x->x2>y->x2)   return 0; } return 1;} */struct In { int x; int y; }a[100]; int cmp( const void *a , const void *b ) { struct In *c = (In *)a; struct In *d = (In *)b; if(c->x != d->x) return c->x - d->x; else return c->y - d->y; } int MaxVisitors(int X[], int Y[], int n){     int main(){ int i,n; cin>>n; for(i=0;i<n;i++)  cin>>a[i].x>>a[i].y;  qsort(a,n,sizeof(a[0]),cmp);  MaxVisitors(int X[], int Y[], int n)  for(i=0;i<n;i++)  cout<<a[i].x<<"   "<<a[i].y<<endl;} PS:写程序的草稿而已!

阅读(3086) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册