結果

問題 No.246 質問と回答
ユーザー mura40424mura40424
提出日時 2015-08-01 14:17:57
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 366 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 11,472 ms
コンパイル使用メモリ 432,648 KB
実行使用メモリ 71,132 KB
平均クエリ数 100.00
最終ジャッジ日時 2024-04-12 12:11:20
合計ジャッジ時間 21,625 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 298 ms
70,956 KB
testcase_01 AC 291 ms
70,872 KB
testcase_02 AC 291 ms
70,380 KB
testcase_03 AC 299 ms
70,696 KB
testcase_04 AC 340 ms
70,728 KB
testcase_05 AC 293 ms
70,556 KB
testcase_06 AC 297 ms
70,996 KB
testcase_07 AC 295 ms
71,020 KB
testcase_08 AC 340 ms
70,804 KB
testcase_09 AC 292 ms
71,064 KB
testcase_10 AC 295 ms
70,808 KB
testcase_11 AC 296 ms
70,796 KB
testcase_12 AC 364 ms
70,692 KB
testcase_13 AC 296 ms
71,048 KB
testcase_14 AC 303 ms
70,804 KB
testcase_15 AC 295 ms
70,948 KB
testcase_16 AC 366 ms
70,908 KB
testcase_17 AC 305 ms
70,508 KB
testcase_18 AC 326 ms
70,976 KB
testcase_19 AC 301 ms
70,656 KB
testcase_20 AC 348 ms
71,112 KB
testcase_21 AC 297 ms
70,792 KB
testcase_22 AC 299 ms
70,764 KB
testcase_23 AC 303 ms
70,696 KB
testcase_24 AC 345 ms
70,532 KB
testcase_25 AC 297 ms
70,788 KB
testcase_26 AC 293 ms
71,132 KB
testcase_27 AC 292 ms
71,044 KB
testcase_28 AC 356 ms
70,792 KB
testcase_29 AC 300 ms
70,436 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)
var count = 0
var ans = 0

fun QandA(left : Double, right : Double) {
    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.0, MAX)
}
0