div2的A啊……sb模拟
六种情况搞来搞去
#include<cstdio> #include<iostream> #include<cstring> #include<cstdlib> #include<algorithm> #include<cmath> #include<queue> #include<deque> #include<set> #include<map> #include<ctime> #define LL long long #define inf 0x7ffffff #define pa pair<int,int> #define pi 3.1415926535897932384626433832795028841971 using namespace std; LL a,b,c,ans; inline LL read() { LL x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int main() { a=read();b=read();c=read(); ans=a+b+c; ans=max(ans,a+b*c); ans=max(ans,a*b+c); ans=max(ans,(a+b)*c); ans=max(ans,a*(b+c)); ans=max(ans,a*b*c); printf("%lld\n",ans); }