結果

問題 No.253 ロウソクの長さ
ユーザー mura40424mura40424
提出日時 2015-08-01 18:01:13
言語 Kotlin
(1.9.23)
結果
RE  
実行時間 -
コード長 477 bytes
コンパイル時間 12,990 ms
コンパイル使用メモリ 409,788 KB
実行使用メモリ 70,452 KB
平均クエリ数 3024.97
最終ジャッジ日時 2023-09-23 05:32:12
合計ジャッジ時間 38,081 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 314 ms
66,328 KB
testcase_02 AC 321 ms
65,712 KB
testcase_03 AC 313 ms
66,068 KB
testcase_04 AC 311 ms
68,036 KB
testcase_05 AC 317 ms
65,920 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 312 ms
66,160 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 322 ms
65,524 KB
testcase_15 AC 324 ms
66,056 KB
testcase_16 AC 311 ms
65,844 KB
testcase_17 AC 335 ms
65,992 KB
testcase_18 RE -
testcase_19 AC 314 ms
65,708 KB
testcase_20 RE -
testcase_21 AC 322 ms
66,180 KB
testcase_22 AC 311 ms
65,612 KB
testcase_23 RE -
testcase_24 AC 325 ms
66,152 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 311 ms
66,308 KB
testcase_35 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:24:10: warning: parameter 'args' is never used
fun main(args : Array<String>) {
         ^

ソースコード

diff #

var MAX = Math.pow(10.0,9.0).toInt() + 1
var count = 0

fun askCandle(left : Int, right : Int) {
    count++
    var x = (left + right) / 2

    println("? " + x.toInt())
    var ans = readLine()!!.toInt()

    if(ans == 1) {
        askCandle(x - 1, right)
    }
    else if(ans == -1){
        askCandle(left, x - 2)
    }
    else {
        var res = (x - 1) + count
        println("! " + res)
        return
    }
}

fun main(args : Array<String>) {
    askCandle(0, 10)
}
0