usaco Friday the Thirteenth

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yalishiyanzhouyu888/article/details/50659598
#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;
}

阅读更多

没有更多推荐了,返回首页