Submission #213593

#TimeUsernameProblemLanguageResultExecution timeMemory
213593berryzed시간과 날짜 (KRIII5P_1)Java
2 / 7
876 ms49432 KiB
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 timeMemoryGrader output
Fetching results...