結果

問題 No.1816 MUL-DIV Game
ユーザー yudedako
提出日時 2022-01-25 18:49:07
言語 Scala(Beta)
(3.6.2)
結果
AC  
実行時間 1,159 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 9,604 ms
コンパイル使用メモリ 270,284 KB
実行使用メモリ 69,612 KB
最終ジャッジ日時 2024-12-17 12:56:10
合計ジャッジ時間 43,383 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.collection.mutable
import scala.io.StdIn.*
import scala.math.{min, max}
@main def main =
  val n = readLine().toInt
  val a = readLine().split(' ').map(_.toInt)
  if n == 1 then
    println(a.head)
  else if n % 2 == 1 then
    println(1)
  else if n == 2 then
    println(a.foldLeft(1L)(_ * _))
  else
    val sorted = a.sorted
    val minA = sorted(0).toLong * sorted(1)
    val minB = sorted(2)
    println(min(minA, minB))

0