結果

問題 No.246 質問と回答
ユーザー javyjavy
提出日時 2015-12-07 05:18:39
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 1,638 bytes
コンパイル時間 15,955 ms
コンパイル使用メモリ 417,180 KB
実行使用メモリ 68,380 KB
平均クエリ数 31.00
最終ジャッジ日時 2023-09-23 20:10:07
合計ジャッジ時間 25,994 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 310 ms
65,888 KB
testcase_01 AC 286 ms
66,400 KB
testcase_02 AC 292 ms
66,176 KB
testcase_03 AC 291 ms
66,132 KB
testcase_04 AC 296 ms
66,084 KB
testcase_05 AC 295 ms
65,884 KB
testcase_06 AC 294 ms
65,992 KB
testcase_07 AC 292 ms
67,088 KB
testcase_08 AC 292 ms
66,444 KB
testcase_09 AC 296 ms
65,808 KB
testcase_10 AC 298 ms
66,268 KB
testcase_11 AC 301 ms
65,844 KB
testcase_12 AC 304 ms
66,828 KB
testcase_13 AC 301 ms
66,484 KB
testcase_14 AC 301 ms
66,112 KB
testcase_15 AC 296 ms
65,960 KB
testcase_16 AC 292 ms
68,380 KB
testcase_17 AC 292 ms
66,064 KB
testcase_18 AC 297 ms
66,328 KB
testcase_19 AC 293 ms
66,332 KB
testcase_20 AC 291 ms
68,148 KB
testcase_21 AC 303 ms
66,048 KB
testcase_22 AC 296 ms
66,184 KB
testcase_23 AC 291 ms
66,412 KB
testcase_24 AC 297 ms
66,352 KB
testcase_25 AC 299 ms
65,900 KB
testcase_26 AC 299 ms
65,968 KB
testcase_27 AC 300 ms
66,296 KB
testcase_28 AC 299 ms
66,436 KB
testcase_29 AC 299 ms
65,868 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

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 bafD = (maxV + minV).toDouble() / 2
    var baf = bafD.toLong()
    while (maxV != minV) {
        println("? "  + (minV + baf))
        val outou = readLineInt()
        if (outou == 1) {
            minV = minV + baf
        } else {
            maxV = minV + baf - 1
        }
        bafD /= 2
        baf = Math.ceil(bafD).toLong()
    }
    println("! " + minV)
}
0