标签:style blog class code java javascript color int http rgb com
输入
1
500 3
150 300
100 200
输出结果
470 471
100 200
150
300
470 471
#include <iostream> #include<stdlib.h> using namespace std; struct node { int a ; int b; }s[100]; int compare(const void *a,const void *b) { node *pa=(node *)a; node *pb=(node *)b; return pa->a-pb->a; } int main() { int len; cin>>len; while(len--) { int lenOFroad; cin>>lenOFroad; int count; cin>>count; for(int i=0;i<count;i++) { cin>>s[i].a; cin>>s[i].b; } qsort(s,count,sizeof(node),compare); for(int i=1;i<count;i++) { cout<<s[i].a<<"\t"<<s[i].b; } cout<<endl; } return 0; }
标签:style blog class code java javascript color int http rgb com
原文地址:http://www.cnblogs.com/hansongjiang/p/3702867.html