/* ID: modengd1 PROG: friday LANG: C++ */ #include <iostream> #include <stdio.h> #include <memory.h> using namespace std; int days[12]={31,29,31,30,31,30,31,31,30,31,30,31}; int N; int counter[7]; bool isleap(int x) { if((x%4)==0&&(x%100)!=0||((x%400)==0)) return true; return false; } int main() { freopen("friday.in","r",stdin); freopen("friday.out","w",stdout); scanf("%d",&N); memset(counter,0,sizeof(counter)); long long day=1; for(int i=0;i<N;i++) { if(isleap(1900+i)) { days[1]=29; } else days[1]=28; for(int j=0;j<12;j++) { counter[(day+13)%7]++; day+=days[j]; } } cout<<counter[0]; for(int i=1;i<7;i++) cout<<‘ ‘<<counter[i]; putchar(‘\n‘); return 0; }
时间: 2024-10-13 11:55:22