結果

問題 No.1816 MUL-DIV Game
ユーザー ripityripity
提出日時 2022-01-21 22:50:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 2,095 ms
コンパイル使用メモリ 72,032 KB
実行使用メモリ 63,268 KB
最終ジャッジ日時 2023-08-17 07:10:52
合計ジャッジ時間 14,769 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
53,712 KB
testcase_01 AC 126 ms
55,700 KB
testcase_02 AC 126 ms
55,712 KB
testcase_03 AC 126 ms
55,976 KB
testcase_04 AC 127 ms
55,644 KB
testcase_05 AC 127 ms
56,392 KB
testcase_06 AC 125 ms
55,740 KB
testcase_07 AC 126 ms
55,908 KB
testcase_08 AC 126 ms
55,480 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    
    public static Scanner sc = new Scanner(System.in);
    public static PrintWriter pw = new PrintWriter(System.out);
    
    public static void main(String[] args) {
        
        int T = 1;
        while( T > 0 ) {
            solve();
            T--;
        }
        
        pw.flush();
        
    }
    
    static void solve() {
        
        int N = sc.nextInt();
        long[] a = new long[N];
        for( int i = 0; i < N; i++ ) {
            a[i] = sc.nextInt();
        }
        
        Arrays.sort(a);
        if( N == 1 ) {
            pw.println(a[0]);
        }else if( N == 2 ) {
            pw.println(a[0]*a[1]);
        }else if( N > 2 && N%2 == 1 ) {
            pw.println(Math.min(a[0]*a[1],a[2]));
        }else {
            pw.println(1);
        }
        
    }
    
}
0