摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1009View Code 1 #include<stdio.h> 2 #include<algorithm> 3 using namespace std; 4 5 struct Trade 6 { 7 int j,f; 8 double percent; 9 }mouse[3001];10 bool cmp(Trade a,Trade b)11 {12 return a.percent>b.percent;13 }14 int main()15 {16 int m,n,i;... 阅读全文
posted @ 2013-04-26 16:41
zlyblog
阅读(154)
评论(0)
推荐(0)
摘要:
Problem Description有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。Input输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示队伍的个数,M表示接着有M行的输入数据。接下来的M行数据中,每行也有两个整数P1,P2表示即P1队赢了P2队。Output给出一个符合要求的排名。输出时队伍号之间有空格, 阅读全文
posted @ 2013-04-26 10:49
zlyblog
阅读(606)
评论(0)
推荐(0)
摘要:
#include <algorithm>using namespace std;1.默认的sort函数是按升序排。对应于1)sort(a,a+n); //两个参数分别为待排序数组的首地址和尾地址2.可以自己写一个cmp函数,按特定意图进行排序。对应于2)例如:int cmp( const int &a, const int &b ){ if( a > b ) return 1; else return 0;}sort(a,a+n,cmp);是对数组a降序排序又如:int cmp( const POINT &a, const POINT &b ) 阅读全文
posted @ 2013-04-26 08:17
zlyblog
阅读(185)
评论(0)
推荐(0)

浙公网安备 33010602011771号