結果

問題 No.1849 Three Times Value
ユーザー yudedakoyudedako
提出日時 2022-03-01 11:35:58
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 924 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 13,699 ms
コンパイル使用メモリ 245,612 KB
実行使用メモリ 62,068 KB
最終ジャッジ日時 2023-09-21 22:44:43
合計ジャッジ時間 43,335 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 898 ms
61,440 KB
testcase_01 AC 905 ms
61,332 KB
testcase_02 AC 910 ms
61,264 KB
testcase_03 AC 908 ms
61,364 KB
testcase_04 AC 901 ms
61,300 KB
testcase_05 AC 902 ms
61,408 KB
testcase_06 AC 893 ms
61,240 KB
testcase_07 AC 905 ms
61,484 KB
testcase_08 AC 911 ms
61,312 KB
testcase_09 AC 908 ms
61,240 KB
testcase_10 AC 906 ms
61,308 KB
testcase_11 AC 904 ms
61,644 KB
testcase_12 AC 899 ms
61,240 KB
testcase_13 AC 894 ms
61,308 KB
testcase_14 AC 907 ms
61,352 KB
testcase_15 AC 910 ms
61,300 KB
testcase_16 AC 924 ms
61,348 KB
testcase_17 AC 924 ms
61,376 KB
testcase_18 AC 902 ms
62,068 KB
testcase_19 AC 917 ms
61,364 KB
testcase_20 AC 903 ms
61,752 KB
testcase_21 AC 897 ms
61,264 KB
testcase_22 AC 922 ms
61,296 KB
testcase_23 AC 910 ms
61,340 KB
testcase_24 AC 910 ms
61,104 KB
testcase_25 AC 921 ms
61,528 KB
testcase_26 AC 914 ms
61,300 KB
testcase_27 AC 907 ms
61,356 KB
testcase_28 AC 900 ms
61,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.collection.mutable.*
import scala.io.StdIn.*
import scala.util.chaining.*
import scala.math.*
import scala.reflect.ClassTag
import scala.util.*
import scala.annotation.tailrec
import scala.collection.mutable

extension (value: Int)
  def toTriple: Long = value.toString.pipe(s => (s + s + s).toLong)
@main def main =
  val n = readLine.toLong
  var min = 0
  var max = 100000
  while min < max do
    val mid = (min + max) >>> 1
    if mid.toTriple <= n then
      min = mid + 1
    else
      max = mid
  println(max - 1)
0