結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー 👑 箱星箱星
提出日時 2020-10-09 22:58:24
言語 Kotlin
(1.9.23)
結果
RE  
実行時間 -
コード長 1,120 bytes
コンパイル時間 14,964 ms
コンパイル使用メモリ 422,688 KB
実行使用メモリ 63,976 KB
最終ジャッジ日時 2023-09-27 19:11:26
合計ジャッジ時間 20,413 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 268 ms
50,040 KB
testcase_01 AC 274 ms
49,756 KB
testcase_02 AC 279 ms
52,116 KB
testcase_03 AC 279 ms
51,988 KB
testcase_04 AC 283 ms
52,352 KB
testcase_05 AC 472 ms
63,976 KB
testcase_06 AC 488 ms
63,336 KB
testcase_07 AC 496 ms
61,944 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
権限があれば一括ダウンロードができます

ソースコード

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()
        val p = Array(2 * n) { 0 }
        for (i in 0 until n) {
            p[i] = 2 * i
            p[i + n] = 2 * i + 1
        }
        var v = 1
        var count = 0
        do {
            v = p[v]
            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