結果
| 問題 | No.1849 Three Times Value |
| ユーザー |
|
| 提出日時 | 2022-03-01 11:35:58 |
| 言語 | Scala(Beta) (3.6.2) |
| 結果 |
AC
|
| 実行時間 | 904 ms / 2,000 ms |
| コード長 | 537 bytes |
| 記録 | |
| コンパイル時間 | 12,373 ms |
| コンパイル使用メモリ | 260,060 KB |
| 実行使用メモリ | 62,440 KB |
| 最終ジャッジ日時 | 2024-07-07 15:50:42 |
| 合計ジャッジ時間 | 40,463 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
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)