結果
問題 | No.246 質問と回答 |
ユーザー |
|
提出日時 | 2015-07-18 05:44:44 |
言語 | Scala(Beta) (3.6.2) |
結果 |
AC
|
実行時間 | 858 ms / 2,000 ms |
コード長 | 991 bytes |
コンパイル時間 | 12,400 ms |
コンパイル使用メモリ | 255,272 KB |
実行使用メモリ | 79,488 KB |
平均クエリ数 | 82.00 |
最終ジャッジ日時 | 2024-07-16 19:50:27 |
合計ジャッジ時間 | 39,174 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
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() } }