题解 | #三角形的边#(不需要算最小值和次小值)
三角形的边
https://www.nowcoder.com/practice/05dbd1cd43b24dbbae567b3e816d4e97
#include <iostream> #include <algorithm> using namespace std; int calDiff(int a,int b,int c) { int diff; int maxn = max({a,b,c}); diff = (a + b + c) - 2*maxn; return diff; } int main() { int a, b, c; while(cin >> a >> b >> c) { if(!(a == 0 && b == 0 && c == 0)){ cout << calDiff(a, b, c) << endl; } } return 0; }