Submission

Status:

[PPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: KanemiyaKana

Problemset: คิดถึงแม่

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-24 21:22:46

#include <iostream>
#include <string>
using namespace std;
// INFO: annual mother's day is on 12th August
// So from 31st December it should be 31 + 29(take the example of year 2567) + 31 + 30 + 31 + 30 + 31 + 12 = 225 days
// INFO ABOVE IS WRONG THEY WANTED IT COUNTED BACKWARDS so 31 + 30 + 31 + 30 + 19 = 141 days
int motherfinder(int startingdate)
{
    int daysahead = 141 % 7;
    int mothersday = startingdate - daysahead;
    if (mothersday <= 0)
    {
        mothersday = 7 + mothersday;
    }

    return mothersday;
}

int main()
{
    int input;
    cin >> input;
    if (1 > input || input > 7)
    {
        return 0;
    }
    else
    {
        int output = motherfinder(input);
        cout << output;
    }
}