#include<iostream>
using namespace std;
#define ISYEAP(x) x%100!=0 && x%4==0||x%400==0 ? 1:0
int dayofMonth[13][2]={
0,0,31,31,28,29,31,31,30,30,31,31,30,30,31,31,31,31,30,30,31,31,30,30,31,31};
struct date{
int year;
int month;
int day;
void nextDay(){
day++;
if (day>dayofMonth[month][ISYEAP(year)]){
day=1;
month++;
if(month>12){
month=1;
year++;
}
}
}
};
int buf[3001][13][32];
int main(){
date tmp;
int cnt=1;
tmp.day=1;
tmp.month=1;
tmp.year=0;
int y1,m1,d1;
while(tmp.year!=3001){
buf[tmp.year][tmp.month][tmp.day]=cnt;
tmp.nextDay();
cnt++;
}
while(cin>>y1>>m1>>d1){
cout<<buf[y1][m1][d1]-buf[y1][1][1]+1<<endl;
}
return 0;
}
日期类问题预处理是王道!
九度OJ学习笔记 题目1070
最新推荐文章于 2023-08-25 15:10:46 发布