1 条题解
-
0
C :
#include<stdio.h> int main() { float a,b,c; scanf("%f,%f,%f",&a,&b,&c); printf("%.2f",(a+b)*c/2); }C++ :
#include<stdio.h> #include<math.h> int main() { double a,b,c,s; //freopen("1021A2.in","r",stdin); //freopen("1021A2.out","w",stdout); scanf("%lf,%lf,%lf",&a,&b,&c); s=(a+b)*c/2.0; printf("%.2lf\n",s); return 0; }Java :
import java.util.Scanner; public class Main { public static void main(String[] agrs){ Scanner input=new Scanner(System.in); String s1=input.nextLine(); String[] x=s1.split(","); double sd=Double.parseDouble(x[0]); double xd=Double.parseDouble(x[1]); double h=Double.parseDouble(x[2]); double s=(sd+xd)*h/2; System.out.println(String.format("%.2f",s)); } }Python :
# coding=utf-8 #python2 u,d,h=map(float,raw_input().split(',')) s=float((u+d)*h/2) print("%.2f"%s)C# :
using System; using System.Collections.Generic; using System.Diagnostics.SymbolStore; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace ConsoleApp2 { internal class Program { static void Main() { //int[] days = { 31,28,31,30,31,30,31,31,30,31,30,31}; string[] a1 = Console.ReadLine().Split(','); double r = Convert.ToDouble(a1[0]); double b = Convert.ToDouble(a1[1]); double h = Convert.ToDouble(a1[2]); float pi = 3.1415926f; string S = ((r + b) * h / 2).ToString("0.00"); Console.WriteLine(S); Console.ReadKey(); } } }
- 1
信息
- ID
- 16
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 1
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者