結果

問題 No.1816 MUL-DIV Game
ユーザー startcppstartcpp
提出日時 2022-01-22 01:32:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 734 ms
コンパイル使用メモリ 69,700 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 09:44:47
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

int n;
int a[100000];

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	
	if (n == 1) cout << a[0] << endl;
	if (n == 2) cout << a[0] * a[1] << endl;
	if (n >= 3 && n % 2 == 1) cout << 1 << endl;
	if (n >= 4 && n % 2 == 0) cout << min(a[0] * a[1], a[2]) << endl;
	
	return 0;
}
0