-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDatum.java
More file actions
41 lines (36 loc) · 815 Bytes
/
Copy pathDatum.java
File metadata and controls
41 lines (36 loc) · 815 Bytes
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
33
34
35
36
37
38
39
40
41
// Success in 0.07s
import java.util.Scanner;
public class Datum{
private static final String[] DOTW = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
};
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int day = 3 + sc.nextInt() + monthToDay(sc.nextInt());
System.out.println(DOTW[day % 7]);
}
private static int monthToDay(int month){
int ret = 0;
switch(month){
case 12: ret += 30;
case 11: ret += 31;
case 10: ret += 30;
case 9: ret += 31;
case 8: ret += 31;
case 7: ret += 30;
case 6: ret += 31;
case 5: ret += 30;
case 4: ret += 31;
case 3: ret += 28;
case 2: ret += 31;
case 1: break;
}
return ret;
}
}