Submission
Status:
PPPPPPPPP----PP-PPPP
Subtask/Task Score:
75/100
Score: 75
User: code
Problemset: ปฏิทินวันแม่
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-25 15:13:15
#include <bits/stdc++.h>
using namespace std;
int main(){
int m;cin>>m;
int d;cin>>d;
int arr[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int day=7-d+1;
if (m<=8){
for (int i=m-1;i<8;i++){
for (int j=1;j<6;j++){
int test=day+7;
day=test;
if (i==7 && test>=12){
break;
}
if (day>arr[i]){
day-=arr[i];
break;
}
//cout<<day<<" ";
}
//cout<<"ok"<<day<<"ok";
}
if (day==12){
cout<<7;
}else{
day-=12;
cout<<7-day;
}
}else if(m>8){
int cnt_day=0;
for (int n=m-1;n<12;n++){
//cout<<n<<endl;
cnt_day+=arr[n];
//cout<<cnt_day<<" ";
}
cnt_day+=219;
//cout<<cnt_day<<" ";
cnt_day-=day;
//cout<<cnt_day<<" ";
cnt_day%=7;
//cout<<cnt_day<<" ";
cnt_day+=5;
if (cnt_day>7){
cnt_day-=7;
}
cout<<cnt_day;
}
}