1 条题解

  • 0
    @ 2023-6-11 12:20:42

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
       int x;
       cin>>x;
       if(x % 2 == 0 || x % 3 == 0){
       	  cout<<"Y"<<endl;
       }else{
       	  cout<<"N"<<endl;
       }
    }
    
    

    Java :

    import java.util.Scanner;
    public class Main
    {   
    	public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
    		if(a%2==0 || a%3==0) {
    			System.out.println("Y");
    		}else{
    			System.out.println("N");
    		}
    		
    		
        }
    }
    

    Python :

    n = int(input())
    if n % 2 == 0 or n % 3 == 0:
        print('Y')
    else:
        print('N')
    
    
    • 1

    信息

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