1 solutions

  • 0
    @ 2025-11-5 15:09:05

    C :

    #include <stdio.h>
     
    int main()
    {
        int N;
        float b1,b;
        while(scanf("%d",&N) != EOF)
     {
     if (N==1)
      {
        printf("X 3 4 5\n");
    	printf("%c %.2f %.2f %.2f\n",80,1.0/10,3.0/10,6.0/10);	
      } 
      else if(N==2){
      	printf("X 1 2 3 4 5 6\n");
    	printf("%c %.2f %.2f %.2f %.2f %.2f %.2f\n",80,11.0/36,9.0/36,7.0/36,
    	5.0/36,3.0/36,1.0/36);
      }
     else if(N==0)
         printf("%d\n",1);	
      
      }
        return 0;
    }
    
    

    C++ :

    #include <iostream>
    #include <string>
    using namespace std;
    
    int main()
    {
        int N; 
        string b;
    
        
        while(scanf("%d",&N) != EOF)
    	
      { 
    	  
    	if (N==1)
    	{
    		b="X 3 4 5\nP 0.10 0.30 0.60";
    	    cout<<b<<endl; 
    	}else if(N==2){
    		b="X 1 2 3 4 5 6\nP 0.31 0.25 0.19 0.14 0.08 0.03";
    	    cout<<b<<endl; 	
    	}
    	else{
    		b="1";
    	    cout<<b<<endl; 
    		return 0;
    	}	
      }
    		
    	
    	
    	
    	
    return 0;
    
    
    
    }
    
    

    Java :

    import java.util.Scanner;
    public class Main{
    
    	public static void main(String[] args) {
    		Scanner reader = new Scanner(System.in); 
    		int a;
    		while(reader.hasNext()){
    			a = reader.nextInt();
    			if(a==0){
    				System.out.println(1);
    			}
    			else if(a==1){
    				System.out.println("X 3 4 5");
    				System.out.println("P 0.10 0.30 0.60");
    			}
    			else if(a==2){
    				System.out.println("X 1 2 3 4 5 6");
    				System.out.println("P 0.31 0.25 0.19 0.14 0.08 0.03");
    			}
    			
    		}
    
    	}
    
    }
    
    • 1

    Information

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