#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int nums[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int isleap_year(int year){
if(year%400==0 ||year%4==0 && year%100!=0) return 1;
else return 0;
}
int get_day(int month){
if(month==2 && isleap_year(month)) return 29;
else return nums[month];
}
void next_day(int &year,int &month,int &day){
day++;
if(day>get_day(month)){
day=1,month++;
}
if(month>12){
month=1,year++;
}
}
int main(){
int year=2000,month=1,day=1;
int tianshu=1;
int n=366;
while(n--){
if(month==5 && day==4) {
//单天也算作一天
tianshu++;
break;
};
next_day(year,month,day);
tianshu++;
}
cout<<tianshu;
return 0;
}
0 回复
0 转发
1 喜欢
10 阅读



