Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 1e5+10;
- int arr[4];
- char op[3];
- bool cmp(int i,int j)
- {
- return i<j;
- }
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(NULL);
- cout.tie(NULL);
- #ifndef ONLINE_JUDGE
- //freopen("input.txt", "r", stdin);
- //freopen("out.txt", "w", stdout);
- #endif // ONLINE_JUDGE
- for(int i=0;i<4;i++)
- cin>>arr[i];
- for(int i=0;i<3;i++)
- cin>>op[i];
- sort(arr,arr+4);
- sort(op,op+3,cmp);
- for(int i=0;i<3;i++)
- {
- if(op[i]=='*')
- arr[i+1]=arr[i]*arr[i+1];
- else
- arr[i+1]=arr[i]+arr[i+1];
- sort(arr,arr+4);
- }
- cout<<arr[3];
- //cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement