Primitive enumeration of all options c++
Posted by
Mikhail 15 Aug 2020 13:17
//We need to sort out 3 in the second power of the options for the arrangement of signs
#include <iostream>
using namespace std;
int main()
{
int a, b, c, min;
cin >> a >> b >> c;
min = a + b + c;
if(a + b - c < min) min = a + b - c;
if(a - b + c < min) min = a - b + c;
if(a - b - c < min) min = a - b - c;
if(a - b + c < min) min = a - b + c;
if(a - b * c < min) min = a - b * c;
if(a * b * c < min) min = a * b * c;
if(a * b + c < min) min = a * b + c;
if(a * b - c < min) min = a * b - c;
cout << min;
return 0;
}