Monday, March 16, 2015

Solution of 479A. Expression (Codeforces)

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int p[10];

int main()
{
    int a, b, c, i;
    scanf("%d%d%d", &a, &b, &c);
    p[0] = a*b+c;
    p[1] = a+b*c;
    p[2] = a*(b+c);
    p[3] = (a+b)*c;
    p[4] = a+b+c;
    p[5] = a*b*c;
    sort(p, p+6);
    printf("%d\n", p[5]);
}


No comments:

Post a Comment

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...