/* ID: chinux1 PROG: friday LANG: C++11 */#include <iostream>#include <fstream>#include <string>#include <vector>#include <map>usingnamespacestd;intgetFebDays(intyear);boolisLeapYear(intyear);intgetDaysForMonth(intyear,intmonth){switch(month){case2:returngetFebDays(year);break;case4:case6:case11:case9:return30;break;default:return31;break;}}intgetFebDays(intyear){if(isLeapYear(year)){return29;}else{return28;}}boolisLeapYear(intyear){if(year%100==0&&year%400==0){returntrue;}elseif(year%100==0){returnfalse;}elseif(year%4==0){returntrue;}else{returnfalse;}}staticvector<int>frequency={0,0,0,0,0,0,0};intmain(){ofstreamfout("friday.out");ifstreamfin("friday.in");// Line 1intN=0;fin>>N;// Compute Date for Jan 1st 1900intfirstDayOfTheMonth=0;for(inti=0;i<N;i++){intyear=1900+i;for(intj=1;j<=12;j++){frequency[(firstDayOfTheMonth+12)%7]++;// Update to next monthfirstDayOfTheMonth=(firstDayOfTheMonth+getDaysForMonth(year,j))%7;}}for(inti=5;i<12;i++){// Starting from Saturday.fout<<frequency[i%7];if(i==11){fout<<endl;}elsefout<<" ";}return0;}