Submission

Status:

PPPPPPPPP-P--PP-PPPP

Subtask/Task Score:

80/100

Score: 80

User: limsan20122

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-30 16:10:29

#include <iostream>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x=0;
    int y=0;
    int z=0;
    int a=0;
    cin >> x >> y;
    if(x<=8){
        for(int i=x;i<=8;i++){
            if(i==1){
                z+=31;
            }
            if(i==2){
                z+=28;
            }
            if(i==3){
                z+=31;
            }
            if(i==4){
                z+=30;
            }
            if(i==5){
                z+=31;
            }
            if(i==6){
                z+=30;
            }
            if(i==7){
                z+=31;
            }
            if(i==8){
                z+=12;
            }
        }
        a=z%7;
        if(y+a-1<=7){
            cout << y+a-1;
        }else{
            cout << (y+a-1)-7;
        }
        a=0;
        z=0;
    }else{
        for(int i=x;i>=8;i--){
            if(i==9){
                z+=19;
            }
            if(i==10){
                z+=30;
            }
            if(i==11){
                z+=31;
            }
            if(i==12){
                z+=30;
            }
        }
        a=z%7;
        if(y-a-1<=0){
            cout << 7-(y-a-1);
        }else{
            cout << y-a-1;
        }
       // cout << " " << z;
    }
    return 0;
}