結果

問題 No.2208 Linear Function
ユーザー 👑 箱
提出日時 2023-02-10 21:21:23
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 995 bytes
コンパイル時間 15,203 ms
コンパイル使用メモリ 418,804 KB
実行使用メモリ 54,684 KB
最終ジャッジ日時 2023-09-21 22:20:12
合計ジャッジ時間 17,448 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 272 ms
52,508 KB
testcase_01 AC 305 ms
52,776 KB
testcase_02 AC 312 ms
54,664 KB
testcase_03 AC 302 ms
54,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

fun PrintWriter.solve() {
    val numCases = nextInt()
    case@ for (_i in 0 until numCases) {
        val l = nextInt()
        val r = nextInt()
        val a = nextInt()
        val b = nextInt()
        println(maxOf(a * l + b, a * r + b))
    }
}

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