Start: Jun, 26, 2019 08:30:00
2019年度暑期短学期第一天
End: Jun, 26, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: C
Result: Accepted
Time: 25ms
Memory: 1712kB
Author: 2018212212236
In contest: 1273

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<iterator>
using namespace std;
bool rn(int x) {
	return (x % 400 == 0 || ((x % 4 == 0) && (x % 100 != 0)));

}
int main() {
	int y, m, d, i, j;
	int a[2][13] = {{0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31,29,31,30,31,30,31,31,30,31,30,31}};
	int b[2] = {365, 366};
	while(cin >> y >> m >> d) {
		int allday = 0;
		for(i = 1500; i < y; i++) {
			allday += b[rn(i)];
		}
		for(i = 1; i < m; i++) {
			allday += a[rn(y)][i];
		}
		allday += d;
		allday %= 7;
		switch(allday) {
		case 1:
			cout << "Monday" << endl;
			break;
		case 2:
			cout << "Tuesday" << endl;
			break;
		case 3:
			cout << "Wednesday" << endl;
			break;
		case 4:
			cout << "Thursday" << endl;
			break;
		case 5:
			cout << "Friday" << endl;
			break;
		case 6:
			cout << "Saturday" << endl;
			break;
		case 0:
			cout << "Sunday" << endl;
			break;
		}
	}

	return 0;
}