文章

11

粉丝

34

获赞

0

访问

2.4k

头像
日期差值 题解:
P1290 上海交通大学/西北工业大学2019机试
发布于2024年3月23日 16:00
阅读数 138

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <stdlib.h>
bool isLeapYear(int year) {
    if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
        return true;
    }
    else {
        return false;
    }
}
int days[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
int sum(int n) {
    int day, month, year;
    day = n % 100;
    n /= 100;
    month = n % 100;
    n /= 100;
    year = n % 10000;
    n /= 10000;
    int res = 0;
    for (int i = year-1; i > 0; i--) {
        if (isLeapYear(i)) {
   &nbs...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发