文章

27

粉丝

0

获赞

130

访问

8.3k

头像
相隔天数 题解:
jsd VIP
P1825 复旦大学机试
发布于2025年2月7日 20:15
阅读数 348

#include<bits/stdc++.h>
using namespace std;

bool isLeapYear(int year) {
    if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
        return true;
    } else {
        return false;
    }
}

int main() {
    string s;
    cin>>s;
    map<int, int> rmp = {{1, 31}, {2, 29}, {3, 31}, {4, 30}, {5, 31}, {6, 30}, {7, 31}, {8, 31}, {9, 30}, {10, 31}, {11, 30}, {12, 31}};
    map<int, int> mp  = {{1, 31}, {2, 28}, {3, 31}, {4, 30}, {5, 31}, {6, 30}, {7, 31}, {8, 31}, {9, 30}, {10, 31}, {11, 30}, {12, 31}};
    int year = stoi(s.substr(0, 4));
    int month = stoi(s.substr(4, 2));
    int day = stoi(s.substr(6, 2));
    if(year >= 2019 || (year == 2012 && month >= 2) || (year == 2012 &...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发