結果

問題 No.1816 MUL-DIV Game
ユーザー nok0
提出日時 2021-12-20 00:50:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 2,192 ms
コンパイル使用メモリ 196,200 KB
最終ジャッジ日時 2025-01-27 04:04:58
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for(auto &v : a) cin >> v;
	sort(a.begin(), a.end());
	if(n == 1) {
		cout << a[0] << endl;
	} else if(n == 2) {
		cout << (long long)a[0] * a[1] << endl;
	} else if(n % 2) {
		cout << 1 << endl;
	} else
		cout << min((long long)a[0] * a[1], (long long)a[2]) << endl;
}
0