結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー 👑 箱星箱星
提出日時 2020-10-09 22:59:40
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 1,027 bytes
コンパイル時間 14,014 ms
コンパイル使用メモリ 416,972 KB
実行使用メモリ 50,416 KB
最終ジャッジ日時 2023-09-27 19:13:41
合計ジャッジ時間 21,625 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 252 ms
50,340 KB
testcase_01 AC 252 ms
50,360 KB
testcase_02 AC 248 ms
50,264 KB
testcase_03 AC 255 ms
50,264 KB
testcase_04 AC 251 ms
50,364 KB
testcase_05 AC 260 ms
50,416 KB
testcase_06 AC 281 ms
50,256 KB
testcase_07 AC 271 ms
50,248 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val t = sc.nextInt()
    for (_i in 0 until t) {
        val n = sc.nextInt()
        var v = 1
        var count = 0
        do {
            v = if (v < n) { 2 * v } else { 2 * (v - n) + 1 }
            count++
        } while (v != 1)
        println(count)
    }
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}
0