精挑细选 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;
}


 

你可能感兴趣的:(c)