1 solutions

  • 0
    @ 2025-11-5 15:11:10

    C :

    #include <stdio.h>
    
    int main()
    {
      int year, leap;
    
      scanf("%d", &year);
      leap = 0; //0表示非闰年
      if(year % 4 == 0){
        if(year % 100 != 0)
          leap = 1;
      }
      if(year % 400 == 0)
        leap = 1;
      if(leap)
        printf("yes\n");
      else
        printf("no\n");
    
      return 0;
    }
    
    
    
    

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
    int a;
    cin>>a;
    if(a%4==0&&a%100!=0||a%400==0)
    cout<<"yes"<<endl;
    else cout<<"no"<<endl;
    }
    

    Pascal :

    program Jerry001;
    var a:integer;
    begin
    readln(a);
    if (a mod 4=0) and (a mod 100<>0) then writeln('yes')
    else if a mod 400=0 then writeln('yes')
    else writeln('no');
    end.
    
    • 1

    Information

    ID
    16489
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By