1 条题解

  • 0
    @ 2025-9-9 23:52:04

    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

    信息

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