#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre(){freopen("c://test//input.in","r",stdin);freopen("c://test//output.out","w",stdout);}
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x,y) memcpy(x,y,sizeof(x))
#define MP(x,y) make_pair(x,y)
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1,class T2>inline void gmax(T1 &a,T2 b){if(b>a)a=b;}
template <class T1,class T2>inline void gmin(T1 &a,T2 b){if(b<a)a=b;}
const int N=0,M=0,Z=1e9+7,ms63=1061109567;
int a,b,c;
int main()
{
while(~scanf("%d%d%d",&a,&b,&c))
{
int ans=0;
gmax(ans,a+b+c);
gmax(ans,a*b*c);
gmax(ans,(a+b)*c);
gmax(ans,a*(b+c));
gmax(ans,a+b*c);
gmax(ans,a*b+c);
printf("%d\n",ans);
}
return 0;
}
/*
【trick&&吐槽】
水题如果写错变量,很伤,非常伤,血崩!
【题意】
给你三个数a,b,c,数值在[1,10]之间。
三个数之间可以任意加括号,以及加两个运算符号(任选+或*),使得最后运算的结果尽可能大。
让你输出这个最大结果
【类型】
暴力 水题
【分析】
如果不加括号,只有4种运算方式,
+ +
* *
+ *
* +
如果加括号,也不过多了2种运算方式——
*(+)
(+)*
我们枚举所有的运算方式,更新最大值即可。
*/
【Codeforces Round 274 (Div 2)A】【暴力 水题】Expression 三个数值运算使得结果最大
最新推荐文章于 2024-07-11 16:35:49 发布