1 solutions

  • 0
    @ 2025-3-3 16:28:35

    C :

    #include<stdio.h>
    
    void main(){
    	int a,b;
    	int x;
    	scanf("%d%d",&a,&b);
    	
    	if(a==b){
    		x=a*b;
    		printf("%s\n","Y");
    		printf("%d\n",x);
    	}else{
    		x=a*b;
    		printf("%s\n","N");
    		printf("%d\n",x);
    	}
    }
    

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    
    int main(){
    	int m,n;
    	cin>>m>>n;
    	if(m == n){
    		cout<<"Y"<<endl;
    		cout<<m * n<<endl;
    	}else{
    		cout<<"N"<<endl;
    		cout<<m * n<<endl;
    	}
    }
    

    Java :

    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		Scanner sc = new Scanner(System.in);
    		int n = sc.nextInt();
    		int g = sc.nextInt();
    		int s;
    		if(n == g){
    			s = n * g;
    			System.out.println("Y" + " " + s);
    		}else if(n != g){
    			s = n * g;
    			System.out.println("N" + " " + s);
    		}
    		sc.close();
    	}
    
    }
    

    Python :

    n = input().split()
    a = int(n[0])
    b = int(n[1])
    s = a * b
    if a == b:
        print('Y')
        print(s)
    else:
        print('N')
        print(s)
    
    • 1

    Information

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