結果

問題 No.246 質問と回答
ユーザー javyjavy
提出日時 2015-12-07 05:07:08
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 1,559 bytes
コンパイル時間 15,104 ms
コンパイル使用メモリ 422,376 KB
実行使用メモリ 68,556 KB
平均クエリ数 30.00
最終ジャッジ日時 2023-09-23 08:15:03
合計ジャッジ時間 24,670 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 311 ms
66,204 KB
testcase_03 AC 314 ms
66,476 KB
testcase_04 AC 320 ms
66,112 KB
testcase_05 WA -
testcase_06 AC 316 ms
66,140 KB
testcase_07 AC 315 ms
66,304 KB
testcase_08 AC 319 ms
66,128 KB
testcase_09 WA -
testcase_10 AC 318 ms
65,852 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 315 ms
66,756 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 312 ms
66,552 KB
testcase_21 AC 311 ms
66,584 KB
testcase_22 AC 311 ms
66,072 KB
testcase_23 WA -
testcase_24 AC 310 ms
66,424 KB
testcase_25 AC 317 ms
66,452 KB
testcase_26 WA -
testcase_27 AC 316 ms
66,652 KB
testcase_28 WA -
testcase_29 AC 315 ms
65,812 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:60:13: warning: the value 'minV + baf' assigned to 'var maxV: Long defined in Yukicoder.main' is never used
            maxV = minV + baf
            ^

ソースコード

diff #

package Yukicoder

fun main(args: Array<String>) {
    fun readLineLongArray(): List<Long> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toLong() }
        return ret
    }

    fun readLineLong(): Long {
        val str = readLine() as String
        return str.toLong()
    }

    fun readLineInt(): Int {
        val str = readLine() as String
        return str.toInt()
    }

    fun readLineIntArray() : List<Int> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toInt() }
        return ret
    }

    fun readLineDoubleArray(): List<Double> {
        val str = readLine() as String
        val arrStr = str.split(" ")
        val ret = arrStr.map { it.toDouble() }
        return ret
    }

    fun readLineDouble() : Double {
        val str = readLine() as String
        return str.toDouble()
    }

    fun readLineString() : String {
        return readLine() as String
    }

//    fun readLineStringArray(): List<String> {
//        val str = readLine() as String
//        val arrStr = str.split(" ")
//        return arrStr
//    }

    var maxV : Long = 1000000000
//    var maxV : Long = 10
    var minV : Long = 1
    var baf = (maxV + minV) / 2
    while (baf != 0.toLong()) {
        println("? "  + (minV + baf))
        val outou = readLineInt()
        if (outou == 1) {
            minV = minV + baf
        } else {
            maxV = minV + baf
        }
        baf /= 2
    }
    println("! " + minV)
}
0