-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP19.cpp
More file actions
44 lines (41 loc) · 757 Bytes
/
Copy pathP19.cpp
File metadata and controls
44 lines (41 loc) · 757 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
#include <bits/stdc++.h>
using namespace std;
int month[]={31,28,31,30,31,30,31,31,30,31,30,31};
bool run(int year){
if(year%4==0 && year%100!=0) return 1;
if(year%400==0) return 1;
return 0;
}
int ans=0;
int y=1901,m=1,d=6;
void add1(){
d++;
if(m==2){
int templ=28;
if(run(y)) templ++;
if(d>templ) m++,d=1;
}
else{
if(d>month[m-1]){
d=1;
m++;
if(m>12){
y++;
m=1;
}
}
}
if(y>2000){
printf("%d\n",ans);
exit(0);
}
}
int main(){
while(1){
for(int i=0;i<7;i++) add1();
// printf("%d %d %d\n",y,m,d);
if(d==1)
ans++;
}
return 0;
}