답안 #213593

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
213593 2020-03-26T08:48:47 Z berryzed 시간과 날짜 (KRIII5P_1) Java 11
2 / 7
876 ms 49432 KB
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";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 876 ms 49432 KB Output is partially correct