結果

問題 No.246 質問と回答
ユーザー mura40424mura40424
提出日時 2015-08-01 15:29:32
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 456 bytes
コンパイル時間 14,560 ms
コンパイル使用メモリ 416,604 KB
実行使用メモリ 68,164 KB
平均クエリ数 100.00
最終ジャッジ日時 2023-09-23 07:27:03
合計ジャッジ時間 27,967 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 332 ms
65,880 KB
testcase_01 WA -
testcase_02 AC 320 ms
66,656 KB
testcase_03 AC 321 ms
65,756 KB
testcase_04 AC 321 ms
66,432 KB
testcase_05 WA -
testcase_06 AC 325 ms
65,688 KB
testcase_07 AC 323 ms
65,960 KB
testcase_08 AC 325 ms
66,508 KB
testcase_09 WA -
testcase_10 AC 323 ms
65,908 KB
testcase_11 WA -
testcase_12 AC 318 ms
66,756 KB
testcase_13 AC 325 ms
65,940 KB
testcase_14 AC 321 ms
66,604 KB
testcase_15 WA -
testcase_16 AC 326 ms
66,484 KB
testcase_17 AC 326 ms
65,776 KB
testcase_18 AC 330 ms
66,464 KB
testcase_19 AC 331 ms
66,716 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 327 ms
66,536 KB
testcase_24 WA -
testcase_25 AC 331 ms
66,608 KB
testcase_26 AC 329 ms
66,596 KB
testcase_27 AC 329 ms
66,492 KB
testcase_28 AC 325 ms
66,204 KB
testcase_29 AC 361 ms
66,564 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:25:10: warning: parameter 'args' is never used
fun main(args : Array<String>) {
         ^

ソースコード

diff #

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

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

    if(count == 100) {
        System.out.println("! " + x.toInt())
        return
    }

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

    if(ans == 1) {
        QandA(x, right)
    }
    else {
        QandA(left, x - 1)
    }
}

fun main(args : Array<String>) {
    QandA(0, MAX)
}
0