[科大讯飞] 7.31笔试AC 2.8/4
第一道60% 贪心搞的
第二道20% 快排
第三道100% 直接判断矩形左上角和右下角的点是不是在另一个矩形里面
Scanner sc = new Scanner(System.in);
int xTR = sc.nextInt();
int xTC = sc.nextInt();
int xDR = sc.nextInt();
int xDC = sc.nextInt();
int yTR = sc.nextInt();
int yTC = sc.nextInt();
int yDR = sc.nextInt();
int yDC = sc.nextInt();
if(yTR >= xTR && yTR <= xDR && yTC >= xTC && yTC <= xDC) {
System.out.println(1);
} else if(yDR >= xTR && yDR <= xDR && yDC >= xTC && yDC <= xDC) {
System.out.println(1);
} else {
System.out.println(0);
}
第四道100% 直接循环提取char字符在数字48~57的字符拼接即可,要注意第一个字符为'-'号的情况要提前加个'-'即表示输出为负数
各位大佬们A了多少 我好菜啊 感觉题不难 时间不够了 难受 😅
#笔试题目##科大讯飞#