1 条题解

  • 0
    @ 2024-12-24 10:06:19

    C++ :

    #include <iostream>
    using namespace std;
    int judge(int year)
     {
      if(year%4==0&&year%100!=0||year%400==0)
    	  return 1;
      else
    	  return 0;
    }
    int main()
    {
    	int n,y,a;
    	int r[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    	int p[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    	cin>>n>>y;
    	a=judge(n);
    
    	if(a==1)
    	    cout<<r[y-1]<<endl;
    	else
    		cout<<p[y-1]<<endl;
    	return 0;
    
    }
    
    
    • 1

    信息

    ID
    2658
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者