1 条题解
-
0
C++ :
#include <iostream> using namespace std; int main() { int a,b,c,t,s; cin>>a>>b>>c; if(a < b) { t = a; a = b; b = t; } if(a < c) { t = a; a = c; c = t; } if(b < c) { t = b; b = c; c = t; } s = a * b + b * c * 2 + a * c * 2; cout<<s; return 0; }Pascal :
var a:array[1..10000] of longint; i,s,t,j:longint; begin for i:=1 to 3 do read(a[i]); for i:=1 to 3 do for j:=i+1 to 3 do if a[j]>a[i] then begin t:=a[i];a[i]:=a[j];a[j]:=t;end; s:=a[1]*a[2]+a[1]*a[3]*2+a[2]*a[3]*2; write(s); end.Java :
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int temp; int s = 0; if(a < b){ temp = a; a = b; b = temp; } if(b < c){ temp = b; b = c; c = temp; } if(a < b){ temp = a; a = b; b = temp; } s = a * b + (2 * a * c) + (2 * b * c); System.out.println(s); } }Python :
sr=input().split() a=int(sr[0]) b=int(sr[1]) c=int(sr[2]) s=0 s=(a*b+a*c+b*c)*2 if a*b>a*c and a*b>b*c: s=s-a*b elif a*c>a*b and a*c>b*c: s=s-a*c else: s=s-b*c print(s)
- 1
信息
- ID
- 320
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者