ACM (TJU) : 3251


package volume_XXIII;

import java.util.Scanner;

public class Id_3251 {

/**
* @param args
*/
public static void main(String[] args) {

Scanner input = new Scanner (System.in);

int d = input.nextInt();
int m = input.nextInt();

int days [] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int week = 6;

outer:
for ( int i = 1; i <= 12; i++ ) { for ( int j = 1; j <= days [i - 1]; j++ ) { if ( i == m && j == d ) break outer; if ( week % 7 == 0 ) week = 0; week++; } } switch (week) { case 1: System.out.println ("Saturday"); break; case 2: System.out.println ("Sunday"); break; case 3: System.out.println ("Monday"); break; case 4: System.out.println ("Tuesday"); break; case 5: System.out.println ("Wednesday"); break; case 6: System.out.println ("Thursday"); break; case 7: System.out.println ("Friday"); break; } } } [/sourcecode]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s