import java.util.Scanner;
/**
* 2018-09-09 京东java笔试编程第2题
* @author DULU
*
*/
public class Main{
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
// 第 1 行数据
int N = scan.nextInt();
if(N<=0) {
System.out.println("请输入一个正整数");
}else {
// 以下N行数据
Good[] goods = new Good[N];
for(int i = 0;i<N;i++) {
int a = scan.nextInt();
int b = scan.nextInt();
int c = scan.nextInt();
goods[i] = new Good(a,b,c);
}
scan.close();// 此后无数据的输入,关闭输入流
int result = 0; // 保存最后的不合格物品数
for(int i = 0;i<N;i++) {// 两层循环,暴力破解
for(int j = 1;j<N;j++) {
if(goods[j].a>goods[i].a && goods[j].b>goods[i].b && goods[j].c>goods[i].c) {
// 如果满足不合格物品条件
result++;
break; // 判断出是不合格,就不继续循环,避免重复
}
}
}
System.out.println(result);
}// if-esle -end
} // public static void main(String[] args) -end
} // public class Main -end
class Good{
int a;
int b;
int c;
Good(){ // 非必要代码段
System.out.println("无参数,创建失败");
}
Good(int a,int b,int c){
this.a = a;
this.b = b;
this.c = c;
}
}
2018-09-09 京东java笔试编程第2题
最新推荐文章于 2024-08-16 19:14:12 发布