文章
72
粉丝
142
获赞
5
访问
57.7k
#include<iostream>
#include <stdio.h>
using namespace std;
int main(){
int date[12][2]={{1,31},{2,28},{3,31},{4,30},{5,31},{6,30},{7,31},{8,31},{9,30},{10,31},{11,30},{12,31}};
int m,n,year,month,day;
cin>>m;
for(int i=0;i<m;i++){
scanf("%d%d%d",&year,&month,&day);
int k=month;
if(month==12&&day==31){//一年最后一天
year+=1;month=1;day=1;}
else if(date[i-1][1]==day){//一月最后一天
month+=1;day=1;
}else{//普通
day+=1;
}
printf...
登录后发布评论
你的day会超过31变成32