Mister-小方


私信TA

用户名:1104986125

访问量:120482

签 名:

如此英俊为哪般

等  级
排  名 4
经  验 19957
参赛次数 1
文章发表 68
年  龄 19
在职情况 学生
学  校 大连交通大学
专  业 车辆工程

  自我简介:

TA的其他文章

解题思路以及注意事项:

  1. 今天给大家分享的这题不难,但很搞笑哈。

  2. 好久没写过怎么恶心的代码了,今天给大家开开眼哈。

实例代码:

#include"stdio.h"
struct year
{
    int years;
    int month;
    int days;
};
int main()
{
    int t=0;
    struct year yeari;
    scanf("%d %d %d",&yeari.years,&yeari.month,&yeari.days);
    if(((yeari.years%4)==0)&&(yeari.years%100)!=0||((yeari.years%400)==0))
    {
        if(yeari.month==1)
        {
            t=yeari.days;
        }
        if(yeari.month==2)
        {
            t=yeari.days+31;
        }
        if(yeari.month==3)
        {
            t=yeari.days+31+29;
        }
        if(yeari.month==4)
        {
            t=yeari.days+31+29+31;
        }
        if(yeari.month==5)
        {
            t=yeari.days+31+29+31+30;
        }
        if(yeari.month==6)
        {
            t=yeari.days+31+29+31+30+31;
        }
        if(yeari.month==7)
        {
            t=yeari.days+31+29+31+30+31+30;
        }
        if(yeari.month==8)
        {
            t=yeari.days+31+29+31+30+31+30+31;
        }
        if(yeari.month==9)
        {
            t=yeari.days+31+29+31+30+31+30+31+31;
        }
        if(yeari.month==10)
        {
            t=yeari.days+31+29+31+30+31+30+31+31+30;
        }
        if(yeari.month==11)
        {
            t=yeari.days+31+29+31+30+31+30+31+31+30+31;
        }
        if(yeari.month==12)
        {
            t=yeari.days+31+29+31+30+31+30+31+31+30+31+30;
        }
    }
    else
    {
        if(yeari.month==1)
        {
            t=yeari.days;
        }
        if(yeari.month==2)
        {
            t=yeari.days+31;
        }
        if(yeari.month==3)
        {
            t=yeari.days+31+28;
        }
        if(yeari.month==4)
        {
            t=yeari.days+31+28+31;
        }
        if(yeari.month==5)
        {
            t=yeari.days+31+28+31+30;
        }
        if(yeari.month==6)
        {
            t=yeari.days+31+28+31+30+31;
        }
        if(yeari.month==7)
        {
            t=yeari.days+31+28+31+30+31+30;
        }
        if(yeari.month==8)
        {
            t=yeari.days+31+28+31+30+31+30+31;
        }
        if(yeari.month==9)
        {
            t=yeari.days+31+28+31+30+31+30+31+31;
        }
        if(yeari.month==10)
        {
            t=yeari.days+31+28+31+30+31+30+31+31+30;
        }
        if(yeari.month==11)
        {
            t=yeari.days+31+28+31+30+31+30+31+31+30+31;
        }
        if(yeari.month==12)
        {
            t=yeari.days+31+28+31+30+31+30+31+31+30+31+30;
        }

    }
    printf("%d",t);
    return 0;
}

相信大家都懂了,可以在下方评论区留言,批判批判哈

 

0.0分

1 人评分

  评论区

#include<stdio.h>
int month_day[2][13]={{0,31,29,31,30,31,30,31,31,30,31,30,31},{0,31,28,31,30,31,30,31,31,30,31,30,31}};
struct day
{
    int year;
    int month;
    int day;
    int flag;
};
int to_day(struct day days);
int main(void)
{
    int year;
    int month;
    int day;
    struct day days;
    scanf("%d%d%d",&days.year,&days.month,&days.day);
    if((days.year%400==0)||(days.year%4==0 && days.year%100!=0))
    days.flag=0;
    else days.flag=1;
    printf("%d",to_day(days));
    return 0;
}
int to_day(struct  day days)
{
    int sum=0;
    for(int j=1;j<=days.month-1;j++)
    sum+=
2017-07-24 16:33:04 | |
  • «
  • 1
  • »