标题:hdu2005 不知道为什么是wrong answer
取消只看楼主
清尘J
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2013-2-17
结帖率:80%
已结贴  问题点数:10 回复次数:1 
hdu2005 不知道为什么是wrong answer
#include<stdio.h>
bool is_run(int year){
    if((year%4==0&&year%100!=0)||(year%400==0))
        return true;
    else
        return false;
}
int main(){
    int year,month,day;
    int day0;
    while(scanf("%d/%d%/%d",&year,&month,&day)!=EOF){
        switch(month){
        case 1:
            day0=0;
            break;
        case 2:
            day0=31;
            break;
        case 3:
            day0=59;
            break;
        case 4:
            day0=90;
            break;
        case 5:
            day0=120;
            break;
        case 6:
            day0=151;
            break;
        case 7:
            day0=181;
            break;
        case 8:
            day0=212;
            break;
        case 9:
            day0=243;
            break;
        case 10:
            day0=273;
            break;
        case 11:
            day0=304;
            break;
        case 12:
            day0=334;
            break;
        }
        day0=day0+day;
        if(is_run(year))
            day0=day0+1;
        printf("%d\n",day0);
    }
    return 0;
}
        

搜索更多相关主题的帖子: false include return wrong 
2013-02-19 10:43
清尘J
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2013-2-17
得分:0 
多谢指导!!
 我太大意了!
肯能是编程太少了,考虑总是不全面!
呵呵


2013-02-19 10:58



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-398778-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.165531 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved