2 条题解

  • 1
    @ 2025-1-23 12:27:19
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a,b;
    	cin>>a>>b;
    	if(b==1||b==3||b==5||b==7||b==8||b==10||b==12) cout<<31;
    	if(b==4||b==6||b==9||b==11) cout<<30;
    	if(a%4==0&&a%100!=0&&b==2||a%400==0&&b==2) cout<<28;
    	else if(b==2) cout<<29;
    	return 0;
    }
    
    • 0
      @ 2025-10-7 19:20:22

      #include<bits/stdc++.h> using namespace std; int main() { int a,s,b; cin>>a>>s;

              if(s<8)
              {
              	if(s%2==1)
              	{
              		b=31;
      			}
      			else
      			{
      				if(s==2)
      				{
      					if(a%100==0)
      		            {
      			            if(a%400==0)
      			            {
      				            b=29;
      			            }
      			            else
      			            {
      			            	b=28;
      						}
      		           }
      		           else
      				   {
      		           	    if(a%4==0)
      		           	    {
      		           	    	b=29;
      						}
      						else
      						{
      							b=28;
      						}
      				   }
      				}
      				b=30;
      			}
      		}
      		else
      		{
      			if(s%2==0)
      			{
      				b=31;
      			}
      			else
      			{
      				b=30;
      		    }
      		}
      		cout<<b;
      return 0;
      

      }

      • 1

      信息

      ID
      43
      时间
      1000ms
      内存
      64MiB
      难度
      7
      标签
      递交数
      16
      已通过
      9
      上传者