这道题不懂为什么编译错误了,求各位大佬看看
查看原帖
这道题不懂为什么编译错误了,求各位大佬看看
233023
myn0637楼主2020/8/15 22:15


#include<bits/stdc++.h>
using namespace std;
int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31},w[8],n,we=1;
int judge(int x)
{
	if(x%4==0)
    {
    		if(x%100==0&&x%400!=0)
           return 0;
    		else return 1;
    	}
    else return 0;
}
int main()
{
	cin>>n; 
    for(int i=1900;i<=1900+n-1;i++)
    {
    	for(int j=1;j<=12;j++)
    	{
    		int d=1,mo;
    		mo=judge(i)?m[j]+1:m[j];
    		while(d<=mo)
    		{
    			d++;
    			if(we<=7)
				we++;
				else we=1;
				if(d==13)
				w[we]++; 
    		}

    	}
    	}
    }
    cout<<w[6]<<" "<<w[7]<<" "<<w[1]<<" "<<w[2]<<" "<<w[3]<<" "<<w[4]<<" "<<w[5];
	return 0;
}

2020/8/15 22:15
加载中...