結果

問題 No.246 質問と回答
ユーザー ともきともき
提出日時 2015-07-18 05:44:44
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 868 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 10,444 ms
コンパイル使用メモリ 257,260 KB
実行使用メモリ 76,768 KB
平均クエリ数 82.00
最終ジャッジ日時 2023-09-23 20:02:37
合計ジャッジ時間 38,647 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 846 ms
75,828 KB
testcase_01 AC 858 ms
75,168 KB
testcase_02 AC 838 ms
75,624 KB
testcase_03 AC 841 ms
75,436 KB
testcase_04 AC 845 ms
75,976 KB
testcase_05 AC 868 ms
75,588 KB
testcase_06 AC 843 ms
76,476 KB
testcase_07 AC 864 ms
76,268 KB
testcase_08 AC 853 ms
76,068 KB
testcase_09 AC 837 ms
76,620 KB
testcase_10 AC 865 ms
75,480 KB
testcase_11 AC 861 ms
75,448 KB
testcase_12 AC 843 ms
76,088 KB
testcase_13 AC 858 ms
75,952 KB
testcase_14 AC 853 ms
76,768 KB
testcase_15 AC 857 ms
75,756 KB
testcase_16 AC 852 ms
76,228 KB
testcase_17 AC 842 ms
76,000 KB
testcase_18 AC 854 ms
75,960 KB
testcase_19 AC 852 ms
75,680 KB
testcase_20 AC 849 ms
76,212 KB
testcase_21 AC 847 ms
75,928 KB
testcase_22 AC 849 ms
75,660 KB
testcase_23 AC 845 ms
76,132 KB
testcase_24 AC 846 ms
76,052 KB
testcase_25 AC 862 ms
75,768 KB
testcase_26 AC 847 ms
75,544 KB
testcase_27 AC 854 ms
76,292 KB
testcase_28 AC 866 ms
76,104 KB
testcase_29 AC 866 ms
75,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.io.StdIn.readLine
import scala.collection.mutable.PriorityQueue
import scala.annotation.tailrec

// PriorityQueue[Long]()(scala.math.Ordering.Long.reverse)
package net.pushl {
  package number {
    // Prime  (Prime.scala)
    // Number (Number.scala)
  }
  package string {
    // RollingHash (RollingHash.scala)
  }
  object EnRich {
    implicit class AString(val self : String) extends AnyVal {
      def splitToIntArray = self.split(" ").map(_.toInt)
    }
  }
}

object Main {
  def main(args : Array[String]) : Unit = {
    var lower = 0           // lower < x
    // var upper = 100  // x <= upper
    var upper = 1000000010  // x <= upper

    for(i <- 0 to 80){
      val mid = (lower+upper)/2
      println(s"? $mid")
      Console.flush()
      val mid_is_greater_than_or_equal_to_x = readLine() == "1"
      if(mid_is_greater_than_or_equal_to_x){
        lower = mid
      }else{
        upper = mid
      }
    }
    println(s"! $lower")
    Console.flush()
  }
}
0