코드포스 479A (codeforces 479A)

코드포스 479A (codeforces 479A) 문제 풀이 및 코드 (description and code)

목차

Problem - 479A - Codeforces

코드

import java.io.*;

public class CF479A {
    static int[] a = new int[3];
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        for (int i = 0; i < 3; i++) a[i] = Integer.parseInt(br.readLine());
        int max = a[0] + a[1] + a[2];
        max = Math.max(max, (a[0] + a[1]) * a[2]);
        max = Math.max(max, (a[1] + a[2]) * a[0]);
        max = Math.max(max, (a[0] * a[1]) + a[2]);
        max = Math.max(max, (a[1] * a[2]) + a[0]);
        max = Math.max(max, a[0] * a[1] * a[2]);
        bw.write(max + "\n");
        bw.flush();bw.close();
    }
}

설명

Copied to clipboard