백준
[1924] 2007년
by Jcoder
2018. 5. 14.
#include <stdio.h>
int main()
{
char month[13];
int i, m, d, sum = 0;
month[1] = month[3] = month[5] = month[7] = month[8] = month[10] = month[12] = 31;
month[4] = month[6] = month[9] = month[11] = 30;
month[2] = 28;
scanf("%d %d", &m, &d);
for (i = 1; i < 13; i++)
{
if (i == m)
{
break;
}
sum += month[i];
}
sum += d;
switch (sum % 7)
{
case 0:
printf("SUN");
break;
case 1:
printf("MON");
break;
case 2:
printf("TUE");
break;
case 3:
printf("WED");
break;
case 4:
printf("THU");
break;
case 5:
printf("FRI");
break;
case 6:
printf("SAT");
break;
}
return 0;
}