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.HashMap;
import java.util.Scanner;
public class WEEKLYCALENDAR {
public static void main(String[] args) {
int end_day[] = {31,28,31,30,31,30,31,31,30,31,30,31};
HashMap<string integer=""> days= new HashMap<string integer="">();
days.put("Sunday", 1);
days.put("Monday", 2);
days.put("Tuesday", 3);
days.put("Wednesday", 4);
days.put("Thursday", 5);
days.put("Friday", 6);
days.put("Saturday", 7);
Scanner sc = new Scanner(System.in);
int cases = sc.nextInt();
while (cases-- > 0) {
int month = sc.nextInt();
int last_month = month==1?11:month-2;
int day = sc.nextInt();
String week = sc.next();
int index = days.get(week);
int weeks[] = new int[7];
for(int i=1;7>=i;i++){
int print = day-index+i<1 data-blogger-escaped-day-index="" data-blogger-escaped-end_day="" data-blogger-escaped-i="" data-blogger-escaped-last_month="">end_day[month-1]?day-index+i-end_day[month-1]:day-index+i);
weeks[i-1]=print;
}
System.out.println(weeks[0]+" "+weeks[1]+" "+weeks[2]+" "+weeks[3]+" "+weeks[4]+" "+weeks[5]+" "+weeks[6]);
}
}
}
|
댓글 없음:
댓글 쓰기