文章

70

粉丝

0

获赞

233

访问

9.1k

头像
日期 题解:不断累加一天,直到指定日期,得到相差几天
P1011 贵州大学机试题
发布于2026年3月20日 20:57
阅读数 235

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>

using namespace std;

int md[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};

int count_day(int m, int d){
    int nm=4,nd=12;
    int count=0;
    while( nm!=m || nd!=d ){
        nd++;
        count++;
        if(nd > md[nm]){
            nd=1;
            nm++;
        }
    }
    return count;
}

string a[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};

int main(){
    int m,d;
    while(cin>>m...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发