思路:平年闰年天数不一样,每个月的天数也不一样,分别用数组存起来,拿总得天数倒减。
代码:
#include <iostream>
#include<stdio.h>
using namespace std;
int isyear(int n)
{
if(n%400==0||(n%4==0&&n%100!=0))return 1;
return 0;
}
int main()
{
int n,i;
int year,month,day;
int tol=246;
int m[2][12]={
{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
int k=1778;
int y[2]={365,366};
while(cin>>n)
{
k=1778;
if(n<=246)
{
n--;
i=4;
if(n==0)cout<<"1777-04-30"<<endl;
else{
while(n-m[0][i]>0)
{