1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| import java.util.Scanner;
public class Main {
public static void main(String args[]){ Scanner sc = new Scanner(System.in);
int m = sc.nextInt(); int d = sc.nextInt();
String[] day = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; int[] month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int preYear = 2006; int res;
int totalDays = (preYear)*365 + (preYear/4 - preYear/100 + preYear/400);
for(int i = 0; i < m-1; i++) { totalDays += month[i]; }
totalDays += d; res = totalDays % 7;
System.out.println(day[res]); sc.close();
}
}
|