1 条题解

  • 0
    @ 2025-9-9 23:46:53

    C :

    #include <stdio.h>
    int main() {
        int n ; scanf("%d" , &n ) ;
        if( n % 400 == 0 || n % 4 == 0 && n % 100 != 0 ) printf("yes\n") ;
        else printf("no\n") ;
        return 0 ;
    }
    

    C++ :

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

    Java :

    import java.util.Scanner;
    
    public class Main {
    	public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int y = in.nextInt();
            if(y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)){
            	System.out.println("yes");
            }else{
            	System.out.println("no");
            }
    		}
    
    	}
    

    Python :

    # coding=utf-8
    year = int(input())
    
    if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
        print("yes")
    else:
        print("no")
    
    • 1

    信息

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