Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: ChanakanStudy

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-11 20:55:17

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <numeric>
#include <iomanip>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
    int daypass = 0;
    int m,d;
    cin >> m >> d;
    if(m < 8) {
        while (m < 8) {
            daypass += month[m-1];
            m++;
        }
        daypass += 11;
        int change = daypass%7;
        if((d + change)%7 == 0) {
            cout << 7 ;
        }
        else {
            cout << (d + change)%7;
        }
    }
    else if (m == 8) {
        daypass += 11;
        int change = daypass%7;
        if((d + change)%7 == 0) {
            cout << 7 ;
        }
        else {
            cout << (d + change)%7;
        }
    }
    else if (m > 8) {
        while (m > 8) {
            m--;
            if(m == 8) {
                break;
            }
            daypass += month[m-1];
        }
        daypass += 20;
        int change = daypass%7;
        int final = (d - change+7) % 7;
        cout << final;
    }
    return 0;
}