Submission

Status:

PPPPPPPPP----PP-PPPP

Subtask/Task Score:

75/100

Score: 75

User: zenta4u

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-01 10:13:11

#include <bits/stdc++.h>
using namespace std;
int daysInMonth[13] = {0,
 31,28,31,30,31,30,
 31,31,30,31,30,31};
int main(){
    int m, d;
    cin >> m >> d;
    int totalDays=0;
    if(m <= 8){
        for(int i=m; i<8; i++) totalDays += daysInMonth[i];
        totalDays += 12; 
    }else{
        for(int i=m; i<=12; i++) totalDays += daysInMonth[i];
        for(int i=1; i<8; i++) totalDays += daysInMonth[i];
        totalDays += 12;
    }
    int ans = (d + (totalDays-1)) % 7;
    if(ans==0) ans=7;
    cout << ans;
}