精挑细选 n 263

这题主要是使用一下#include<limits.h>,有点忘了,调了些时间啊,需要练习一下了可怜可怜

#include<stdio.h>
#include<limits.h>

int main()
{
    int length, radius, data;
    
    int N, m;
    scanf("%d",&N);
    while(N--)
    {
        length = INT_MIN;
        radius = INT_MAX;
        data = INT_MIN;
        scanf("%d", &m);
        while(m--)
        {
             int a, b, c;
             scanf("%d%d%d", &a, &b, &c);
             if(a>length)
             {
                  length = a;
                  radius = b;
                  data = c;
             }
             if(a==length)
             {
                  if(b<radius)
                  {
                     length = a;
                     radius = b;
                     data = c;
                  }
                  if(b==radius && c>=data)
                  {
                       length = a;
                       radius = b;
                       data = c;         
                  }
             }
        }
        printf("%d\n", data);
    }
    return 0;
}


 

posted on 2011-11-29 11:06  java课程设计例子  阅读(215)  评论(0编辑  收藏  举报