#include <iostream>
using namespace std;
enum days { Monday = 1, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };
enum months { January = 1, February, March, April, May, June, July, August, September, October, November, December };
short year = 1901;
short month = 1;
short day = 2;
int counter;
void Check(int a)
{
if((a==1) && (day==Sunday))
counter++;
}
int main()
{
int current_day;
while(1)
{
if((month == December) && (year == 2000) && (current_day == 31))
break;
if((month == April) || (month == September) || (month == June) || (month == November))
for(current_day=1; current_day<=30; current_day++)
{
Check(current_day);
day++;
if(day>7)
day = 1;
}
else if(month == February)
{
if( ((year%4)==0) && !( ((year%100)==0) && ((year%400)!=0) ))
for(current_day=1; current_day<=29; current_day++)
{
Check(current_day);
day++;
if(day>7)
day = 1;
}
else
for(current_day=1; current_day<=28; current_day++)
{
Check(current_day);
day++;
if(day>7)
day = 1;
}
}
else
for(current_day=1; current_day<=31; current_day++)
{
Check(current_day);
day++;
if(day>7)
day = 1;
}
month++;
if(month>12)
{
month = 1;
year++;
}
}
cout << counter << endl;
return 0;
}
Darmowy hosting zapewnia PRV.PL