4 solutions

  • 0
    @ 2025-7-5 9:42:01
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a,b,n;
        cin>>a>>b;
        if(b==1||b==3||b==5||b==7||b==8||b==10||b==12)
        {
            cout<<"31";
        }
        else if(b==2)
        {
            if(a%4==0 && a%100!=0 || a%400==0)
            {
                cout<<"29";
            }
            else cout<<"28";
        }
        else cout<<"30";
    	return 0;
    }
    
    • 0
      @ 2025-7-5 9:36:50
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int y,m;
          cin>>y>>m;
          if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12) cout<<31;
          else if(m==4 || m==6 || m==9 || m==11) cout<<30;
          else if(y%4==0 && y%100!=0 || y%400==0) cout<<29;
          else cout<<28;
          return 0;
      }  
      
      • -1
        @ 2025-5-17 11:27:37
        #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";
            else if(b==4 || b==6 || b==9 || b==11) cout<<"30";
            else if(a%4==0 && a%100!=0 || a%400==0) cout<<"29";
            else cout<<"28";
        	return 0;
        }
        • -1
          @ 2025-4-13 11:39:10
          ```cpp
          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
              int n,y;
              cin>>n>>y;
              if(y==1||y==3||y==5||y==7||y==8||y==10||y==12)
              {
                  cout<<"31";
              }
              else if(y==4||y==6||y==9||y==11)
              {
                  cout<<"30";
              }
              else  if(n%4==0&&n%100!=0||n%400==0)
              {
                  cout<<"29";
              }
              else cout<<"28";
              return 0;
          }
          
          • 1

          Information

          ID
          2575
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          1
          Tags
          (None)
          # Submissions
          92
          Accepted
          36
          Uploaded By