728x90
문제 바로가기: https://www.acmicpc.net/problem/1924
나의 풀이
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
sc.close();
String[] time = input.split(" ");
int month = Integer.valueOf(time[0]);
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
map.put(1, 31);
map.put(2, 28);
map.put(3, 31);
map.put(4, 30);
map.put(5, 31);
map.put(6, 30);
map.put(7, 31);
map.put(8, 31);
map.put(9, 30);
map.put(10, 31);
map.put(11, 30);
map.put(12, 31);
int count = 0;
for (int i = 1; i < month; i++) {
count += map.get(i);
}
count = count + Integer.valueOf(time[1]);
String[] days = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
System.out.println(days[count % 7]);
}
}
소감
'verdantjuly > 코딩테스트' 카테고리의 다른 글
백준 1193번 : 분수찾기 (Java, 20240327) (0) | 2024.03.27 |
---|---|
백준 25206번 : 너의 평점은 (Java, 20240327) (0) | 2024.03.27 |
백준 2445번 : 별 찍기 - 8 (Java, 20240327) (0) | 2024.03.27 |
백준 2675번 : 문자열 반복 (Java, 20240327) (0) | 2024.03.27 |
백준 3438번 : 별 찍기 -1 (Java, 20240327) (0) | 2024.03.27 |