結果

問題 No.104 国道
ユーザー yo-kondoyo-kondo
提出日時 2018-03-25 16:59:16
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 256 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 11,593 ms
コンパイル使用メモリ 428,232 KB
実行使用メモリ 54,304 KB
最終ジャッジ日時 2024-04-30 17:32:50
合計ジャッジ時間 15,533 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 251 ms
54,300 KB
testcase_01 AC 253 ms
54,264 KB
testcase_02 AC 252 ms
54,152 KB
testcase_03 AC 249 ms
54,236 KB
testcase_04 AC 248 ms
54,140 KB
testcase_05 AC 250 ms
54,108 KB
testcase_06 AC 251 ms
54,220 KB
testcase_07 AC 256 ms
54,260 KB
testcase_08 AC 247 ms
54,244 KB
testcase_09 AC 254 ms
54,092 KB
testcase_10 AC 252 ms
54,304 KB
testcase_11 AC 244 ms
54,276 KB
testcase_12 AC 248 ms
54,116 KB
testcase_13 AC 253 ms
54,232 KB
testcase_14 AC 247 ms
54,236 KB
testcase_15 AC 251 ms
54,140 KB
testcase_16 AC 245 ms
54,040 KB
testcase_17 AC 247 ms
54,104 KB
testcase_18 AC 247 ms
54,208 KB
testcase_19 AC 241 ms
54,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package yukicoder.no104

/**
 * エントリポイント
 */
fun main(args: Array<String>) {
    val in1 = readLine()
    print(nationalHighway(in1))
}

/**
 * いま何号線を歩いているかを返します。
 */
fun nationalHighway(rightOrLeft: String?): String {
    if (rightOrLeft == null) {
        return ""
    }
    var highway = 1
    for (bend in rightOrLeft) {
        if (bend == 'L') {
            highway *= 2
        } else {
            highway = highway * 2 + 1
        }
    }
    return highway.toString()
}
0