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 |
import java.util.Scanner; /** * UVA12019 */ public class UVA12019 { public static void main(String[] args) { String days[] = new String[] { "", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", }; Scanner sc = new Scanner(System.in); int n [] = new int[]{0,31,28,31,30,31,30,31,31,30,31,30,31}; int num = sc.nextInt(); for (int i = 0; i < num; i++) { int day = 0; int m = sc.nextInt() , d = sc.nextInt(); for(int j = m - 1 ; j >= 1 ; j--) day += n[j]; day += d; int thisday = day % 7; System.out.println(days[thisday]); } sc.close(); } } |