-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUVA 1727.cpp
57 lines (41 loc) · 1.23 KB
/
UVA 1727.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<iostream>
using namespace std;
int main()
{
int i,n,m,d;
string mmth[100],dday[100];
string mth,day;
while(cin>>n)
{
for(i=0; i<n; i++)
{
cin>>mmth[i]>>dday[i];
}
for(i=0; i<n; i++)
{
mth=mmth[i];
day=dday[i];
if(mth=="FEB") d=28;
else if(mth=="JAN" || mth=="MAR" || mth=="MAY" ||mth=="JUL" || mth=="AUG" || mth=="OCT" || mth=="DEC") d=31;
else if(mth=="APR" || mth=="JUN" || mth=="SEP" || mth=="NOV") d=30;
if(day=="SUN") m=1;
else if(day=="MON") m=2;
else if(day=="TUE") m=3;
else if(day=="WED") m=4;
else if(day=="THU") m=5;
else if(day=="FRI") m=6;
else if(day=="SAT") m=7;
//logic block :)
if(d==28 && (m==2 || m==3 || m==4 || m==5 || m==1 || m==7)) cout<<"8"<<endl;
if(d==28 && m==6) cout<<"8"<<endl;
if((m==1 || m==2 || m==3) && (d==30 || d==31)) cout<<"8"<<endl;
if(m==4 && d==30) cout<<"8"<<endl;
if(m==4 && d==31) cout<<"9"<<endl;
if(m==5 && d==30) cout<<"9"<<endl;
if(m==5 && d==31) cout<<"10"<<endl;
if((m==6) && (d==30 || d==31)) cout<<"10"<<endl;
if((m==7) && (d==30 || d==31)) cout<<"9"<<endl;
}
}
return 0;
}