hiho week 235 register

Ended

Participants:86

Verdict:Accepted
Score:100 / 100
Submitted:2019-01-03 10:17:40

Lang:G++

Edit
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
#include <bits/stdc++.h>
using namespace std;
struct Date{
    static const int mon[13];
    static const int y1[11];
    static const int y2[16];
    
    int yy,MM,dd,HH,mm,ss;
    bool operator == (const Date &oth){
        return (yy==oth.yy) && (MM==oth.MM) && (dd==oth.dd)
        && (HH==oth.HH) && (mm==oth.mm) && (ss==oth.ss);
    }
    int parse(){
        int time=0;
        for (int i=1970;i<yy;i++){
            time+=365*24*3600;
            if (i%400==0 || i%4==0 && i%100!=0)time+=24*3600;
        }
        for (int i=1;i<MM;i++)time+=mon[i]*24*3600;
        if (MM>2 && (yy%400==0 ||yy%4==0 && yy%100!=0))time+=24*3600;
        time+=dd ? (dd-1)*24*3600 : 0;
        time+=HH*3600 + mm*60 + ss;
        for (int i=0;i<11;i++)if (1900+y1[i]<yy||1900+y1[i]==yy&&MM>6)time++;
        for (int i=0;i<16;i++)if (1900+y2[i]<yy)time++;
        return time;
    }
};
const int Date::mon[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX