# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
213593 | berryzed | 시간과 날짜 (KRIII5P_1) | Java | 876 ms | 49432 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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[1])) 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";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |