Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Neozaawwman1

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-06 23:15:46

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

    cout << result << endl;
	return 0;
}