http://acm.split.hdu.edu.cn/showproblem.php?pid=5948
按题意答案就是最小值加上最大值的2倍。
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <cmath>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
int a,b;
cin>>a>>b;
int sum=min(a,b)+2*max(a,b);
cout<<sum<<endl;
}
return 0;
}
本文提供了一道 HDU 5948 编程题的解答思路及 C++ 代码实现。该题目的核心在于计算两个整数的最小值与最大值,并返回特定的数学表达结果。
236

被折叠的 条评论
为什么被折叠?



