鄙人不才,此中鄙陋甚多,望海涵!!!
这道题只要搞清闰年和平年每个月各有几天即可(说实话我竟然不知道,缺乏生活常识 emmmm)
#include<iostream>
using namespace std;
int y,d,cnt=1,t=-1;
int a[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int b[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
cin>>y>>d;
if(y%4==0 && (y%100!=0 || y%400==0))
{
while(d>a[++t]) d-=a[t],cnt++;
cout<< cnt << endl << d <<endl;
}
else
{
while(d>b[++t]) d-=b[t],cnt++;
cout<< cnt << endl << d <<endl;
}
return 0;
}