标签:
题目地址: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; }
标签:
原文地址:http://www.cnblogs.com/acmsummer/p/4248278.html