結果

問題 No.253 ロウソクの長さ
ユーザー mura40424mura40424
提出日時 2015-08-01 18:03:12
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 12,087 ms
コンパイル使用メモリ 412,124 KB
実行使用メモリ 69,180 KB
平均クエリ数 312.67
最終ジャッジ日時 2023-09-23 05:34:33
合計ジャッジ時間 27,537 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 313 ms
65,808 KB
testcase_01 AC 305 ms
66,184 KB
testcase_02 AC 304 ms
66,044 KB
testcase_03 AC 299 ms
66,516 KB
testcase_04 WA -
testcase_05 AC 313 ms
66,408 KB
testcase_06 AC 311 ms
66,376 KB
testcase_07 AC 311 ms
66,532 KB
testcase_08 AC 310 ms
66,040 KB
testcase_09 WA -
testcase_10 AC 307 ms
66,008 KB
testcase_11 AC 309 ms
66,220 KB
testcase_12 AC 309 ms
66,192 KB
testcase_13 AC 313 ms
66,008 KB
testcase_14 WA -
testcase_15 AC 306 ms
67,012 KB
testcase_16 AC 300 ms
66,660 KB
testcase_17 AC 307 ms
66,380 KB
testcase_18 AC 309 ms
66,220 KB
testcase_19 WA -
testcase_20 AC 309 ms
66,656 KB
testcase_21 AC 301 ms
65,952 KB
testcase_22 WA -
testcase_23 AC 304 ms
66,612 KB
testcase_24 AC 302 ms
65,736 KB
testcase_25 AC 306 ms
66,184 KB
testcase_26 RE -
testcase_27 AC 309 ms
66,564 KB
testcase_28 AC 302 ms
66,184 KB
testcase_29 AC 304 ms
66,352 KB
testcase_30 RE -
testcase_31 AC 308 ms
66,300 KB
testcase_32 AC 308 ms
66,196 KB
testcase_33 AC 302 ms
66,400 KB
testcase_34 WA -
testcase_35 AC 309 ms
66,464 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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, MAX)
}
0