-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpression.cpp
More file actions
48 lines (44 loc) · 744 Bytes
/
Copy pathexpression.cpp
File metadata and controls
48 lines (44 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<iostream>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
int x,y,z;
cin >> x>>y>>z;
if(x==y==z==1){
cout<<3;
return 0;
}
if(x==1){
if(y==1 &&z!=1){
cout<<2*z;
return 0;
}
if(z==1){
cout<<x+y+z;
return 0;
}
cout<<(x+y)*z;
return 0;
}
if(y==1){
if(z==1){
cout<<2*x;
return 0;
}
int r1=(x+y)*z,r2=x*(y+z);
if(r1>r2){
cout<<r1;
return 0;
}
else cout<<r2;
return 0;
}
if(z==1){
cout<<x*(y+z);
return 0;
}
cout<<x*y*z;
return 0;
}