Submission

Status:

PPPPPPPPPPPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: kenmuay

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-13 20:20:30

// #include <bits/stdc++.h>
// using namespace std;


// int main(){
//     int date[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
//     int m,d;
//     cin >> m >> d;
//     int mom=223;
//     d--;
//     int input=0;
//     for(int i=0; i<m-1;i++){
//         input+=date[i];
//     }
    
//     int ans;
//     if(mom>input) ans=(mom-input+d)%7;
//     else if (mom<input) ans=(((mom-input+d)%7)+7)%7;
//     //cout << input << " " << mom << " " << d << endl;
    
//     cout << ans+1;
    
//     return 0;
// }

#include <bits/stdc++.h>
using namespace std;

int main() {
    int m, d;
    scanf("%d %d", &m, &d);
    d--; // 0-6
    int mom = 223; // 0-364
    int date[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
    int input=0; // 0-364
    for(int i=0; i<m-1;i++){
        input+=date[i];
    }
    int ans=(((mom-input+d)%7)+7)%7;

    cout << ans+1;

    return 0;
}