Submission

Status:

P-P-----P-P---------

Subtask/Task Score:

20/100

Score: 20

User: thanakorn

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-28 13:49:37

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,t=0;
	cin>>n>>m;
	int year[12]={31,28,31,30,31,30,31,0,30,31,30,31};
	if(n<=8){
		for(int i=7;i>=n;i--){
			t+=year[i];
		}
		t=t+11+m;
		t=t%7;
	}
	else{
		for(int i=9;i<n-1;i++){
			t-=year[i];
		}
		t=t-20-m;
		t=t%7;
		t=-1*t;
	}
	if(t==0){
		t=7;
	}
	cout<<t;
}