暴力虐水题!!!
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* 题意:给出三个数要求添加运算符(+,*),使其计算结果要最大。一定要所有情况都考虑到
*
* @author TinyDolphin
* 2017/7/2 20:10.
*/
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int[] input = new int[3]; //存放输入的三个数
int maxSum;
while (in.hasNext()) {
for (int index = 0; index < 3; index++) {
input[index] = in.nextInt();
}
if (input[0] == 1 && input[1] != 1 && input[2] != 1) {
maxSum = (input[0] + input[1]) * input[2];
} else if (input[0] != 1 && input[1] == 1 && input[2] != 1) {
if (input[0] < input[2]) {
maxSum = (input[0] + input[1]) * input[2];
} else {
maxSum = input[0] * (input[1] + input[2]);
}
} else if (input[0] != 1 && input[1] != 1 && input[2] == 1) {
maxSum = input[0] * (input[1] + input[2]);
} else if (input[0] == 1 && input[1] == 1 && input[2] != 1) {
maxSum = (input[0] + input[1]) * input[2];
} else if (input[0] == 1 && input[1] != 1 && input[2] == 1) {
maxSum = input[0] + input[1] + input[2];
} else if (input[0] != 1 && input[1] == 1 && input[2] == 1) {
maxSum = input[0] * (input[1] + input[2]);
} else if (input[0] == 1 && input[1] == 1 && input[2] == 1) {
maxSum = input[0] + input[1] + input[2];
} else {
maxSum = input[0] * input[1] * input[2];
}
out.println(maxSum);
}
out.flush();
}
}