码迷,mamicode.com
首页 > 其他好文 > 详细

【HDU】5162 Jump and Jump...

时间:2015-01-25 16:34:47      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5162

发现自己写的max宏有点问题

改成这样:#define max(a,b) ((a>b)?(a):(b)),后面的返回值也要一个括号

#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;


#define read() freopen("in.txt", "r", stdin)
#define write() freopen("out.txt", "w", stdout)
#define rep( i , a , b ) for ( int i = ( a ) ; i <  ( b ) ; ++ i )  
#define For( i , a , b ) for ( int i = ( a ) ; i <= ( b ) ; ++ i ) 
#define clr( a , x ) memset ( a , x , sizeof a )  
#define cpy( a , x ) memcpy ( a , x , sizeof a ) 
#define max(a,b) ((a>b)?(a):(b))
#define LL long long 
#define MaxSize 100000

int main()
{
	//read();
	int T;
	scanf("%d",&T);
	int n;
	while(T--)
	{
		int a,b,c;
		int cp[20];
		scanf("%d",&n);
		for (int i = 0; i < n; ++i)
		{
			scanf("%d%d%d",&a,&b,&c);
			cp[i]=max(max(a,b),c);

		}
		int rank;
		for (int i = 0; i < n; ++i)
		{
			rank = 0;
			for (int j = 0; j < n; ++j)
			{
				if (cp[j] >= cp[i])
				{
					rank++;
				}
			}
			if (i==n-1)
			{
				printf("%d\n",rank );
			}else
			{
				printf("%d ",rank );
			}
		}

	}

    return 0;
   
}

  

【HDU】5162 Jump and Jump...

标签:

原文地址:http://www.cnblogs.com/acmsummer/p/4248278.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!