题解:P15055 [UOI 2023 II Stage] Gallery
题目传送门
题目大意
给定三个整数
解题思路
- 列出所有可能的两两组合:
a+b 、a+c 、b+c ; - 计算这三个组合的和;
- 找出这三个和中的最大值,即为答案。
时间复杂度为
参考代码
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main() {
cin>>a>>b>>c;
int ans=max({a+b,a+c,b+c});
cout<<ans;
return 0;
}
蒟蒻写题解不容易,管理员大大求过。