/ 科创班 /

记录详情

Wrong Answer

/in/foo.c: In function 'leap':
/in/foo.c:29:19: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     leap=year%4==0&&year%100!=0||year%400==0;
          ~~~~~~~~~^~~~~~~~~~~~~
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 256.0 KiB

代码

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int sum_day(int month,int day);
    int leap(int year);
    int year,month,day,days;
    printf("input data(year month,day):");
    scanf("%d,%d,%d",&year,&month,&day);
    days=sum_day(month,day);
    if(leap(year)&&month>=3)
        days+=1;
    printf("Is the %dth day in this year\n",days);
    return 0;
}
int sum_day(int month ,int day)
{
    int day_tab[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int i;
    for (i=1;i<month;i++)

        day+=day_tab[i];
    return(day);
}
int leap(int year)
{
    int leap;
    leap=year%4==0&&year%100!=0||year%400==0;
    return (leap);
}

信息

递交者
类型
递交
题目
求一元三次函数的根
题目数据
下载
语言
C
递交时间
2018-05-10 23:30:02
评测时间
2018-05-10 23:30:02
评测机
分数
0
总耗时
1ms
峰值内存
256.0 KiB