文章

1

粉丝

21

获赞

0

访问

211

头像
日期计算 题解:只有50% 请问有什么问题吗
P1051 中南大学机试题
发布于2024年3月28日 10:29
阅读数 211

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include<map>
using namespace std;
struct node {
    int year;
    int month;
    int day;
}n;

int main() {
    char x[1000];
    while (cin >> n.year >> n.month >> n.day) {
        int f[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        if ((n.year % 400 == 0) || (n.year % 4 == 0) && (n.year % 100 != 0)) {
            f[2] = 29;
        }
        else {
            f[2] = 28;
        }
        int flag = 0;
        if (n.year < 0 || n.year>9999) {
            flag = 1...

登录查看完整内容


登录后发布评论

2 条评论
snake
2024年3月29日 16:16

输出要换行

赞(0)

13729922474 : 回复 snake: 也不行诶

2024年3月30日 00:03