文章

9

粉丝

0

获赞

0

访问

2.7k

头像
日期计算 题解:好心人帮我看看为什么只通过50%,感谢!!!能举出错误的输入示例就更好了,感谢!!!
P1051 中南大学机试题
发布于2024年3月4日 15:57
阅读数 406

#include<stdio.h>
struct note{
int year;
int month;
int day;
}x;
int main(){
    while(scanf("%d%d%d",&x.year,&x.month,&x.day)!=EOF){
    if(x.year<0||x.month<1||x.month>12){
        printf("Input error!\n");
    continue;}
    if(x.month==1||x.month==3||x.month==5||x.month==7||x.month==8||x.month==10||x.month==12){
        if(x.day>31){
        printf("Input error!\n");
    continue;}
    }
    if(x.month==4||x.month==6||x.month==9||x.month==11){
        if(x.day>30){
        printf("Input error!\n");
    continue;}
    }
    int two;int flag=0;
    if((x.year%4 == 0&&x.y...

登录查看完整内容


登录后发布评论

2 条评论
snake
2024年3月5日 09:10

1月31日

赞(0)

A001 : 回复 snake: 谢谢你!!!!!解决了!!你今天也会开心的!!!

2024年3月5日 14:09