Submission

Status:

PPPPPPPPP----PP-PPPP

Subtask/Task Score:

75/100

Score: 75

User: qwert

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-08 13:24:16

#include <iostream>
using namespace std;

int main()
{
	int m,d,arr1[12]={31,28,31,30,31,30,31,11},arr2[6]={-11,31,30,31,30},s=0,f;
	
	cin>>m>>d;
	
	if(m<8){
		for(int i=m-1; i<=7; i++){
		s = s + arr1[i];
		}
				
		f=s%7;
		d=(d+f)%7;
		cout<<d;
	}
	else if(m==8){
		d=(d+4)%7;
		if(d==0){
			d=7;
		}
		cout<<d;
	}
	else{
		for(int i=0; i<m-7; i++){
			s = s + arr2[i];
		}
		f=s%7;
		d=(7-f)+d;
		if(d>7){
			d=d-7;
		}
		if(d==0){
			d=7;
		}
		cout<<s<<" "<<d;
	}

	
	
}