代码简单粗暴
#include<stdio.h>
int year, month, date;
int main()
{
int n, count=1, day[7]={0};
scanf("%d",&n);
year=1900, month=1, date=1;
while(year<1900+n){
for(month=1;month<=12;month++){
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12){
for(date=1;date<=31;date++,count++){
if(date==13)
day[count%7]++;
}
}
else if(month==4||month==6||month==9||month==11){
for(date=1;date<=30;date++,count++){
if(date==13)
day[count%7]++;
}
}
else if(year%4!=0||year%100==0&&year%400!=0&&month==2){
for(date=1;date<=28;date++,count++){
if(date==13)
day[count%7]++;
}
}
else{
for(date=1;date<=29;date++,count++){
if(date==13)
day[count%7]++;
}
}
}
year++;
}
printf("%d %d ", day[6], day[0]);
for(int i=1;i<6;i++){
printf("%d ",day[i]);
}
return 0;
}
```
by 药飛煌 @ 2018-07-19 10:29:26