文章

94

粉丝

0

获赞

19

访问

2.7k

头像
日期计算 题解:
P1051 中南大学机试题
发布于2026年1月24日 19:16
阅读数 26

每个条件都要看到

#include<stdio.h>
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int fun(int x){
    if(x%4==0&&x%100!=0||x%400==0)
    {
        return 1;
    }
    return 0;
}
int main()
{
    int y,m,d;
    while(scanf("%d %d %d",&y,&m,&d)!=EOF)
    {
        if(m<1||m>12){
            printf("Input error!\n");
            continue;
        } 
        if(d<0||d>a[m])
        {
        printf("Input error!\n");    
        continue;
        }
&n...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发