S001-AC.cc
720 Bytes
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
#include <iostream>
#include <string>
using namespace std;
string day_of_the_week(int d, int m, int y)
{
m -= 2;
if(m < 1)
{
m += 12;
y--;
}
int c = y / 100;
int a = y - c*100;
int f = (int)(2.6*m - 0.2) + d + a + (int)(a/4) + (int)(c/4) - 2*c;
f %= 7;
if(f < 0)
{
f += 7;
}
switch(f)
{
case 0:
return "Sunday";
break;
case 1:
return "Monday";
break;
case 2:
return "Tuesday";
break;
case 3:
return "Wednesday";
break;
case 4:
return "Thursday";
break;
case 5:
return "Friday";
break;
case 6:
return "Saturday";
break;
}
}
int main()
{
/*
int d,m,y;
cin >> d;
cin >> m;
cin >> y;
cout << day_of_the_week(d,m,y) << endl;
return 0;
*/
}