// 2019 IUSB Programming Competition // Round 2 Problem 1 // Find out the day of the week for a given date // Solution by Liguo Yu import java.util.*; public class round2_p1 { public static void main(String []args) { int day; int month; int year; Scanner scan = new Scanner(System.in); month = scan.nextInt(); day = scan.nextInt(); year = scan.nextInt(); int result = determine_day_of_week(day, month, year); if (result == 0) System.out.println("Sunday"); else if (result == 1) System.out.println("Monday"); else if (result == 2) System.out.println("Tuesday"); else if (result == 3) System.out.println("Wednesday"); else if (result == 4) System.out.println("Thursday"); else if (result == 5) System.out.println("Friday"); else System.out.println("Saturday"); } static int determine_day_of_week(int day, int month, int year) { int k, m, C, Y, W; int adjusted_year; k = day; if (month > 2) { m = month - 2; adjusted_year = year; } else { m = month + 10; adjusted_year = year - 1; } C = adjusted_year / 100; Y = adjusted_year % 100; W = (int)(k + Math.floor(2.6*m - 0.2) - 2 * C + Y + Math.floor(Y / 4.0) + Math.floor(C / 4.0)); W = W % 7; if (W < 0) W = W + 7; return W; } }