結果

問題 No.1816 MUL-DIV Game
ユーザー 👑 箱星箱星
提出日時 2022-01-21 22:12:55
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 586 ms / 2,000 ms
コード長 1,044 bytes
コンパイル時間 13,555 ms
コンパイル使用メモリ 441,908 KB
実行使用メモリ 66,844 KB
最終ジャッジ日時 2024-05-04 13:15:05
合計ジャッジ時間 27,036 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 265 ms
53,236 KB
testcase_01 AC 263 ms
53,548 KB
testcase_02 AC 267 ms
53,560 KB
testcase_03 AC 276 ms
53,384 KB
testcase_04 AC 273 ms
53,292 KB
testcase_05 AC 262 ms
53,556 KB
testcase_06 AC 262 ms
53,560 KB
testcase_07 AC 278 ms
53,320 KB
testcase_08 AC 271 ms
53,464 KB
testcase_09 AC 345 ms
55,300 KB
testcase_10 AC 456 ms
59,920 KB
testcase_11 AC 437 ms
59,560 KB
testcase_12 AC 431 ms
58,300 KB
testcase_13 AC 467 ms
62,572 KB
testcase_14 AC 433 ms
58,816 KB
testcase_15 AC 452 ms
59,964 KB
testcase_16 AC 393 ms
55,652 KB
testcase_17 AC 507 ms
65,272 KB
testcase_18 AC 518 ms
64,508 KB
testcase_19 AC 447 ms
59,584 KB
testcase_20 AC 542 ms
65,360 KB
testcase_21 AC 422 ms
58,256 KB
testcase_22 AC 414 ms
57,384 KB
testcase_23 AC 270 ms
53,312 KB
testcase_24 AC 262 ms
53,412 KB
testcase_25 AC 582 ms
66,780 KB
testcase_26 AC 539 ms
66,792 KB
testcase_27 AC 586 ms
66,724 KB
testcase_28 AC 574 ms
66,844 KB
testcase_29 AC 578 ms
66,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    val a = Array(n) { nextLong() }
    a.sort()
    if (n == 1) {
        println(a[0])
    } else if (n % 2 == 1) {
        println(1)
    } else if (n == 2) {
        println(a[0] * a[1])
    } else {
        println(minOf(a[0] * a[1], a[2]))
    }
}

fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()
fun nextDouble() = next().toDouble()
// endregion
0