結果

問題 No.1816 MUL-DIV Game
ユーザー ripity
提出日時 2022-01-21 22:51:34
言語 Java
(openjdk 23)
結果
AC  
実行時間 677 ms / 2,000 ms
コード長 876 bytes
コンパイル時間 2,201 ms
コンパイル使用メモリ 74,608 KB
実行使用メモリ 50,848 KB
最終ジャッジ日時 2024-11-26 02:01:17
合計ジャッジ時間 14,720 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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 == 0 ) {
            pw.println(Math.min(a[0]*a[1],a[2]));
        }else {
            pw.println(1);
        }
        
    }
    
}
0