Submission

Status:

[PPPP][PPPPPPPPPPP]

Subtask/Task Score:

{30/30}{70/70}

Score: 100

User: cyblox_boi

Problemset: ดูวีทูปเบอร์

Language: cpp

Time: 0.003 second

Submitted On: 2025-12-27 22:24:09

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

unordered_map<int, int> daysInAMonth = {
    {1, 31},
    {2, 28},
    {3, 31},
    {4, 30},
    {5, 31},
    {6, 30},
    {7, 31},
    {8, 31},
    {9, 30},
    {10, 31},
    {11, 30},
    {12, 31},
};

struct Date
{
    int month;
    int day;

    int calculateDateTillEndOfMonth()
    {
        return daysInAMonth[month] - day + 1;
    }

    int calculateTotalDays(Date &other)
    {
        int total;

        if (month != other.month)
        {
            total = calculateDateTillEndOfMonth() + other.day;

            for (int i = month + 1; i < other.month; i++)
            {
                total += daysInAMonth[i];
            }
        }
        else
        {
            total = other.day - day + 1;
        }

        return total;
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    Date startDate, endDate;
    cin >> startDate.day >> startDate.month;
    cin >> endDate.day >> endDate.month;

    cout << startDate.calculateTotalDays(endDate) * 3 << '\n';

    return 0;
}