4 solutions

  • -1
    @ 2026-1-27 19:31:05
    #include <iostream>
    using namespace std;
    int main() {
        int year,month;
        cin>>year>>month;
        
        int days[]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        bool a=false;
        if ((year%400==0)||(year%4==0&&year%100!=0)){
            a=true;
        }
        if(month==2&&a) {
            cout<<29<<endl;
        }else{
            cout<<days[month-1]<<endl;
        }    
        return 0;
    }
    

    Information

    ID
    21
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    7
    Tags
    # Submissions
    47
    Accepted
    11
    Uploaded By