結果

問題 No.1395 Less Sweet Alchemy
ユーザー 👑 箱
提出日時 2021-02-14 21:27:13
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 683 bytes
コンパイル時間 12,664 ms
コンパイル使用メモリ 414,532 KB
実行使用メモリ 53,808 KB
最終ジャッジ日時 2023-09-29 14:32:30
合計ジャッジ時間 17,581 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 259 ms
53,352 KB
testcase_01 AC 239 ms
53,476 KB
testcase_02 AC 237 ms
53,628 KB
testcase_03 AC 238 ms
53,424 KB
testcase_04 AC 237 ms
53,436 KB
testcase_05 AC 239 ms
53,756 KB
testcase_06 AC 236 ms
53,764 KB
testcase_07 AC 236 ms
53,496 KB
testcase_08 AC 242 ms
53,808 KB
testcase_09 AC 250 ms
53,744 KB
testcase_10 AC 259 ms
53,380 KB
testcase_11 AC 238 ms
53,552 KB
testcase_12 AC 237 ms
53,584 KB
testcase_13 AC 237 ms
53,740 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:8:29: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
    println(if (x in c.min()!!..c.max()!!) "Yes" else "No")
                            ^
Main.kt:8:40: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
    println(if (x in c.min()!!..c.max()!!) "Yes" else "No")
                                       ^

ソースコード

diff #

import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve() {
    val n = nextInt()
    val x = nextInt()
    val c = Array(n) { nextInt() }
    println(if (x in c.min()!!..c.max()!!) "Yes" else "No")
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}

// 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