Submission

Status:

--------------------

Subtask/Task Score:

0/100

Score: 0

User: idiotkill

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-30 11:34:41

// Online C++ compiler (editor)
// Write and run C++ online using this editor.

#include <bits/stdc++.h>
using namespace std;
int main() {
    int x,y;
    cin>>x>>y;
    int month[12]={31 ,28 ,31 ,30, 31 ,30,31 ,31 ,30 ,31 ,30 ,31};
    int ans=0;
    if(x-1<7){
        for(int i=x-1;i<7;i++){
            ans+=month[i];
        }
        ans+=11;
    }else if(x-1>7){
        
    }else{

    }
    int temp=y;
    if(ans%7==0){
        cout<<"0"<<endl;
        cout<<temp;
        
    }else if(ans%7==1){
            cout<<"1"<<endl;
        cout<<y+1;
    }
    else if(ans%7==2){
        cout<<"2"<<endl;
        cout<<y+2;
    }
    else if(ans%7==3){
        cout<<"3"<<endl;
            for(int i=0;i<4;i++){
            if(temp+1>7){
                temp=1;
            }else{
                temp++;
            }
        }
        cout<<temp;
    }
    else if(ans%7==4){
        cout<<"4"<<endl;
        for(int i=0;i<4;i++){
            if(temp+1>7){
                temp=1;
            }else{
                temp++;
            }
        }
        cout<<temp;
    }
    else if(ans%7==5){
        cout<<"5"<<endl;
        cout<<y+5;
    }
    else if(ans%7==6){
        cout<<"6"<<endl;
        for(int i=0;i<6;i++){
            if(temp+1>7){
                temp=1;
            }else{
                temp++;
            }
        }
        cout<<temp;
    }
    else if(ans%7==7){
        cout<<"7"<<endl;
        cout<<y+5;
    }
}