1 solutions

  • 0
    @ 2025-11-5 15:15:59

    C :

    #include "stdio.h"
     
    int main()
    {
        int a;
        float b;
        while(scanf("%d",&a) != EOF)
     {
     if (a==1)
       b=1.0/4;  
     else if (a==0)   
        b=0.20;
         printf("%.2f\n",b);	
     
      }
        return 0;
    }
    
    

    C++ :

    #include <stdio.h> 
    int main()
    {
        int a;
        float b;
        while(scanf("%d",&a) != EOF)
     {if (a==1) b=0.25; //将“作业答案”替换为该题答案。若有多行,用多行重复输出。
     else if (a==0) 
    b=0.20;    
       printf("%.2f\n",b);}
        return 0;
    }
    

    Java :

    import java.util.*;
    public class Main {
    	public static void main(String args[]) {
    		Scanner cin = new Scanner(System.in);
    		int a;
    		int b;
    		while (cin.hasNext()) {
    			a = cin.nextInt(); 
    			if (a==1){
    System.out.printf("0.25\n");
       
    }
    else if (a==0){
      b=1; 
    System.out.printf("0.20\n");}
    }
    	}	}
    

    C# :

    using System;
    
    namespace Sample
    {
        class Program
        {
          
            static void Main(string[] args)
            {		
            	int a;
            	a=Convert.ToInt32(Console.ReadLine());
            		if(a==1){
    		
    		Console.WriteLine("0.25");
    	}
    	else{
    		Console.WriteLine("0.20");
    	}
    
    	//return 0;
              
             
            }
        }
    }
    
    • 1

    Information

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