35 条题解
-
0
// std=c++11 #include <iostream> #include <cstdio> #include <algorithm> using namespace std; int S(int a, int b, int c) // 计算表面积函数 { return (a * b + a * c + b * c) * 2; } int main() { int a, b, c; scanf("%d %d %d", &a, &b, &c); int maxn = max({a * b, a * c, b * c}); printf("%d", S(a, b, c) - maxn); return 0; }
点个赞,嘿嘿~~~
-
0
#include<iostream> using namespace std; int main() { int a, b, c, n = 0; cin >> a >> b >> c; if ((a * b) > (a * c) && (a * b) > (b * c)) { n += a * b + a * c * 2 + b * c * 2; } if ((a * c) > (a * b) && (a * c) > (b * c)) { n += a * c + a * b * 2 + b * c * 2; } if ((b * c) > (a * b) && (b * c) > (a * c)) { n += b * c + a * b * 2 + a * c * 2; } cout << n; return 0; }
-
-1
#include<iostream> #include<cstdio> using namespace std; int main(){ int a,b,c; cin>>a>>b>>c; if(a < b) { int t = b; b = a; a = t; } if(a < c) { int f = c; c = a; a = f; } if(b < c) { int g = c; c = b; b = g; } int num = (a * b) + (b * c) * 2 + (a * c) * 2; cout<<num; } 🎉️ 小盆友们, 全网最复杂代码来喽!!! 一手交赞,一手复制 👀️
-
-2
要做到表面积最少,只要把最大的面作为顶面减掉就可以得出来了
直接上代码
#include<iostream> #include<cstdio> using namespace std; int main(){ int a,b,c,s1,s2,s3,s,maxs=0; cin>>a>>b>>c; s1=a*b;s2=b*c;s3=a*c;//求出各个面的面积 if(s1>maxs) maxs=s1; if(s2>maxs) maxs=s2; if(s3>maxs) maxs=s3;//求出最大的面 cout<<(s1+s2+s3)*2-maxs<<endl;//表面积减掉最大的面 return 0; }
-
-7
#include<iostream> using namespace std; int main() { int a,b,c,sum1,sum2,sum3; cin>>a>>b>>c; sum1=a*b; sum2=a*c; sum3=b*c; if(sum1>sum2 && sum1>sum3) { cout<<sum1+(sum2+sum3)*2; } if(sum2>sum1 && sum2>sum3) { cout<<sum2+(sum1+sum3)*2; } if(sum3>sum2 && sum3>sum1) { cout<<sum3+(sum2+sum1)*2; } return 0; }
信息
- ID
- 337
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 3
- 标签
- 递交数
- 2893
- 已通过
- 1518
- 上传者