import java.util.Scanner;
public class td {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int T = scanner.nextInt();
int[][] xy = new int[T][2];
for (int i = 0; i < T; i++) {
xy[i][0] = scanner.nextInt();
xy[i][1] = scanner.nextInt();
}
// 시간 날짜
for (int[] datetime : xy) {
System.out.println(checkTime(datetime) + " " + checkDate(datetime));
}
}
private static String checkDate(int[] date) {
if (date[0] >= 1 && date[0] <= 12 && date[1] >= 1 && date[1] <= getLastDay(date[0])) return "Yes";
return "No";
}
private static int getLastDay(int month) {
switch (month) {
case 2:
return 29;
case 4:
case 6:
case 9:
case 11:
return 30;
default:
return 31;
}
}
private static String checkTime(int[] time) {
if (time[0] >= 0 && time[0] <= 23 && time[1] >= 0 && time[1] <= 59) return "Yes";
return "No";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
908 ms |
53756 KB |
Output is correct |