Submission

Status:

PPPPPPPPP----PP-PPPP

Subtask/Task Score:

75/100

Score: 75

User: kkxkkx001

Problemset: ปฏิทินวันแม่

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-09 11:22:13

//#include <iostream>
//using namespace std;
//
//int main()
//{
//	int m, d, total;
//	cin >> m;
//	cin >> d;
//	
//	if (m==1){total=1;}
//	if (m==2){total=32;}
//	if (m==3){total=60;}
//	if (m==4){total=91;}
//	if (m==5){total=121;}
//	if (m==6){total=152;}
//	if (m==7){total=182;}
//	if (m==8){total=213;}
//	if (m==9){total=244;}
//	if (m==10){total=274;}
//	if (m==11){total=305;}
//	if (m==12){total=335;}
//	
//	if (total < 224){
//		total = 224-total;
//		total = total%7;
//		total += d;
//		total = total%7;
//		if (total != 0){cout << total;}
//		else {cout << "7";}
//	}
//	else if (total > 224){
//		total = total-224;
//		total = total%7;
//		total += d;
//		total = total%7;
//		if (total != 0){cout << total;}
//		else {cout << "7";}
//	}
//	else {
//		cout << d;
//	}
//}

#include <iostream>
using namespace std;

int main()
{
    int m, d;
    cin >> m >> d;

    // Day number of the 1st day of each month
    int firstDay[] = {
        0,
        1,    // January
        32,   // February
        60,   // March
        91,   // April
        121,  // May
        152,  // June
        182,  // July
        213,  // August
        244,  // September
        274,  // October
        305,  // November
        335   // December
    };

    // August 12 = day 224
    int offset = 224 - firstDay[m];

    int answer = ((d - 1 + offset) % 7) + 1;

    cout << answer;
}