hiho week 235 register

Ended

Participants:86

Verdict:Accepted
Score:100 / 100
Submitted:2019-01-04 19:06:15

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 <iostream>
#define SENTINEL -9999
#define BLANK -9999
typedef struct {
    int year, month, day;
    int hour, minute, second;
} DateTime;
// void printDateTime(const DateTime &d) {
//     std::cout << d.year << "-" << d.month << "-" << d.day 
//         << " " << d.hour << ":" << d.minute << ":" << d.second << std::endl;
// }
bool isLeapYear(int year) {
    return (year%4 == 0 && year%100 != 0) || (year%400 == 0);
}
int yearsJunLeapSec[] = {1972, 1981, 1982, 1983, 1985, 1992, 1993, 1994, 1997, 2012, 2015, SENTINEL};
int yearsDecLeapSec[] = {1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1987, 1989, 1990, 1995, 1998, 2005, 2008, 2016, SENTINEL};
int daysOfMonthNonLeap[13]={BLANK, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int daysOfMonthLeap[13]={BLANK, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool isLeapSec (int year, int leapSecArr[]) {
    for(int i = 0, y = leapSecArr[0]; y != SENTINEL; y = leapSecArr[++i]) {
        if(year == y) {
            return true;
        }
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX