https://www.acmicpc.net/problem/1924
#include <iostream>
using namespace std;
int main(){
int x,y;
int num;
cin >> x >> y;
switch(x){
case 1:
num = 0;
break;
case 2:
num = 31;
break;
case 3:
num = 31+28;
break;
case 4:
num = 31+28+31;
break;
case 5:
num = 31+28+31+30;
break;
case 6:
num = 31+28+31+30+31;
break;
case 7:
num = 31+28+31+30+31+30;
break;
case 8:
num = 31+28+31+30+31+30+31;
break;
case 9:
num = 31+28+31+30+31+30+31+31;
break;
case 10:
num = 31+28+31+30+31+30+31+31+30;
break;
case 11:
num = 31+28+31+30+31+30+31+31+30+31;
break;
case 12:
num = 31+28+31+30+31+30+31+31+30+31+30;
break;
}
switch((num+y)%7){
case 1:
cout << "MON" << '\n';
break;
case 2:
cout << "TUE" << '\n';
break;
case 3:
cout << "WED" << '\n';
break;
case 4:
cout << "THU" << '\n';
break;
case 5:
cout << "FRI" << '\n';
break;
case 6:
cout << "SAT" << '\n';
break;
case 0:
cout << "SUN" << '\n';
break;
}
}
'Programming > BaekJoon' 카테고리의 다른 글
[C++] 백준 2741번 : N 찍기 (0) | 2019.02.18 |
---|---|
[C++] 백준 2292번 : 벌집 (0) | 2019.02.18 |
[C++] 백준 1546번 : 평균 (0) | 2019.02.18 |
[C++] 백준 1476번 : 날짜 계산 (0) | 2019.02.18 |
[C++] 백준 1475번 : 방 번호 (0) | 2019.02.18 |