usaco Friday the Thirteenth

#include<stdio.h>
#include<stdlib.h>
int m[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int d[7];
main(){
	freopen("friday.in","r",stdin);
	freopen("friday.out","w",stdout);
	int i,j,l=6,n;
	scanf("%d",&n);
	n+=1900;
	for(i=1900;i<n;i++){
		if((i%100!=0 && i%4==0)||i%400==0)m[1]++;
		for(j=0;j<12;j++){
			d[l]++;
			l+=m[j];
			l%=7;
		}
		m[1]=28;
	}
	printf("%d",d[6]);
	for(i=0;i<6;i++)
		printf(" %d",d[i]);
	puts("");
	return 0;
}

你可能感兴趣的:(usaco Friday the Thirteenth)