1 条题解

  • 0
    @ 2026-2-10 15:37:21

    C :

    #include<stdio.h>
    int main()
    {
    	int a,b,c;
    	float average;
    	scanf("%d%d%d",&a,&b,&c);
    	average=(a+b+c)/3.0;
    	printf("%.3f\n",average);
    	return 0;
    }
    

    C++ :

    #include<stdio.h>
    int main()
    {
    	int a,b,c;
    	float s;
    	//freopen("1012A5.in","r",stdin);
    	//freopen("1012A5.out","w",stdout);
    	scanf("%d%d%d",&a,&b,&c);
    	s=(a+b+c)/3.0;
    	printf("%.3f",s);
    	return 0;
    }
    
    

    Java :

    import java.util.Scanner;
    public class Main {
    	public static void main(String[] args) {
    		Scanner scan = new Scanner(System.in);
    		int a,b,c;
    		a = scan.nextInt();
    		b = scan.nextInt();
    		c = scan.nextInt();
    		System.out.println(String.format("%.3f",(a+b+c)/3.0));
    	}
    }
    
    

    Python :

    # coding=utf-8
    #python2
    a,b,c=map(int,raw_input().split())
    s=(a+b+c)/3.0
    print("%.3f"%s)
    

    C# :

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApp2
    {
        internal class Program
        {
            static void Main()
            {
                string[] m= Console.ReadLine().Split(' ');
                double a = Convert.ToDouble(m[0]);
                double b = Convert.ToDouble(m[1]);
                double c = Convert.ToDouble(m[2]);
    
    
    
    
    
    
    
                string z = ((a + b + c) / 3).ToString("0.000");
    
                float v = 1.9f;
    
                Console.WriteLine(z);
                Console.ReadKey();
    
            }
    
        }
    }
    
    • 1

    信息

    ID
    7
    时间
    1000ms
    内存
    128MiB
    难度
    10
    标签
    递交数
    2
    已通过
    1
    上传者