/* ID: philipp17 PROG: friday LANG: C++ */ /* LANG can be C++11 or C++14 for those more recent releases */ #include #include #include #include using namespace std; // We start on Monday, and the daylist has to start on Saturday vector DAY_COUNTER(7, 0); int CURRENT_DAY = 2; bool is_leap(int year){ if(year % 400 == 0){ return true; } else if(year % 100 == 0){ return false; } else if(year % 4 == 0){ return true; } return false; } void monthly_routine(int days){ for(int day = 0; day < days; ++day){ if(day == 12){ DAY_COUNTER[CURRENT_DAY] += 1; // cout << CURRENT_DAY << endl; } CURRENT_DAY = (CURRENT_DAY + 1) % 7; } } int main() { ofstream fout ("friday.out"); ifstream fin ("friday.in"); int n; fin >> n; for(int year = 1900; year < 1900 + n; ++year){ // January monthly_routine(31); // February monthly_routine(is_leap(year) ? 29 : 28); // March monthly_routine(31); // April monthly_routine(30); // May monthly_routine(31); // June monthly_routine(30); // July monthly_routine(31); // August monthly_routine(31); // September monthly_routine(30); // October monthly_routine(31); // November monthly_routine(30); // December monthly_routine(31); } for(size_t i = 0; i < DAY_COUNTER.size(); ++i){ fout << DAY_COUNTER[i]; if(i != DAY_COUNTER.size() - 1) fout << " "; } fout << endl; return 0; }