백준 1924

6370 단어 bojboj

백준 1924

#include<iostream>
using namespace std;

int main()
{
    int m, d;
    cin >> m >> d;
    int cnt = 0;
    for (int i = 2; i <= m; i++)
    {
        if (i == 3)
        {
            cnt += 28;
            continue;
        }
        if (i < 9)
        {
            if (i % 2)
                cnt += 30;
            else
                cnt += 31;
        }
        else
        {
            if (i % 2)
                cnt += 31;
            else
                cnt += 30;
        }

    }
  
   cnt += d - 1;
   
      
    switch (cnt % 7)
    {
    case 0: cout << "MON"; break;
    case 1: cout << "TUE"; break;
    case 2: cout << "WED"; break;
    case 3: cout << "THU"; break;
    case 4:cout << "FRI"; break;
    case 5:cout << "SAT"; break;
    case 6:cout << "SUN"; break;
    }
}

좋은 웹페이지 즐겨찾기