2 条题解

  • 0
    @ 2025-5-27 21:07:44
    #include<bits/stdc++.h>
    using namespace std;
    int  main() 
    {
    	 int a;
    	 cin>>a;
         if(a%400==0)
           cout<<"yes";
         else
    	 {
    	   if(a%4==0)
    	   {
    	   	 if(a%100!=0)
    	   	   cout<<"yes";
    	   	  else
    	   	   cout<<"no";
    	     }
    	     else
    	       cout<<"no";	 	
    	   }     
         return 0;
    }
    
    • 0
      @ 2024-12-24 10:06:16

      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
      2568
      时间
      1000ms
      内存
      128MiB
      难度
      10
      标签
      递交数
      5
      已通过
      3
      上传者