#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
struct node{
int len;
int thin;
int num;
}stick[1005];
bool cmp(struct node a, struct node b){
if(a.len != b.len) return a.len>b.len;
else {
if(a.thin != b.thin) return a.thin<b.thin;
else return a.num>b.num;
}
}
int main(){
int t, m;
scanf("%d", &t);
while(t--){
scanf("%d", &m);
for(int i = 0; i < m; i++){
scanf("%d %d %d", &stick[i].len, &stick[i].thin, &stick[i].num);
}
sort(stick, stick+m,cmp);
printf("%d\n", stick[0].num);
}
return 0;
}
精 挑 细 选
时间限制:3000 ms | 内存限制:65535 KB
难度:1
输入
第一行是一个整数N(N<=10)表示测试数据的组数)
每组测试数据的第一行 有一个整数m(m<=1000),表示仓库中所有钢管的数量,
之后m行,每行三个整数,分别表示一根钢管的长度(以毫米为单位)、直径(以毫米为单位)和编码(一个9位整数)。
输出
对应每组测试数据的输出只有一个9位整数,表示选出的那根钢管的编码,
每个输出占一行
样例输入
2 2 2000 30 123456789 2000 20 987654321 4 3000 50 872198442 3000 45 752498124 2000 60 765128742 3000 45 652278122
样例输出
987654321 752498124
描述
小王是公司的仓库管理员,一天,他接到了这样一个任务:从仓库中找出一根钢管。这听起来不算什么,但是这根钢管的要求可真是让他犯难了,要求如下:
1、 这根钢管一定要是仓库中最长的;
2、 这根钢管一定要是最长的钢管中最细的;
3、 这根钢管一定要是符合前两条的钢管中编码最大的(每根钢管都有一个互不相同的编码,越大表示生产日期越近)。
相关的资料到是有,可是,手工从几百份钢管材料中选出符合要求的那根……