-
Notifications
You must be signed in to change notification settings - Fork 0
/
B. Counting Weekend Days
96 lines (88 loc) · 2.21 KB
/
B. Counting Weekend Days
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
ID: musarra1
TASK:
LANG: C++
*/
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
#define pb push_back
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
void read()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
}
map<string,int> mp;
void solve()
{
mp["JAN"]=31;
mp["FEB"]=28;
mp["MAR"]=31;
mp["APR"]=30;
mp["MAY"]=31;
mp["JUN"]=30;
mp["JUL"]=31;
mp["AUG"]=31;
mp["SEP"]=30;
mp["OCT"]=31;
mp["NOV"]=30;
mp["DEC"]=31;
mp["SUN"]=0;
mp["MON"]=1;
mp["TUE"]=2;
mp["WED"]=3;
mp["THU"]=4;
mp["FRI"]=5;
mp["SAT"]=6;
string month,day; cin>>month>>day;
int loop=mp[month];
int cnt=0;
int diff=6-mp[day];
for(int i=1;i<=loop+1;i+=7)
{
if(i+diff<=loop) ++cnt;
if(i+diff-1<=loop and i+diff-1>=1) ++cnt;
}
cout<<cnt<<endl;
}
int main()
{
ios
ll t=1;
cin>>t;
for(ll tc=1;tc<=t;++tc)
{
// cout << "Case " << tc << ":" << endl;
solve();
}
return 0;
}