View Code of Problem 81

#include<iostream>
using namespace std;
int main()
{
	int y,m,d,day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	cin>>y>>m>>d;
	if(y%400==0 || (y%4==0&&y%100!=0)){
		day[2]+=1;
	}
	for(int i=1;i<m;i++)
		d+=day[i];
	cout<<d;
}

Double click to view unformatted code.


Back to problem 81