結果

問題 No.104 国道
ユーザー きつねうどんきつねうどん
提出日時 2023-12-15 23:49:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 616 bytes
コンパイル時間 3,436 ms
コンパイル使用メモリ 75,252 KB
実行使用メモリ 58,088 KB
最終ジャッジ日時 2023-12-15 23:49:47
合計ジャッジ時間 7,269 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
57,976 KB
testcase_01 AC 125 ms
57,704 KB
testcase_02 AC 125 ms
57,964 KB
testcase_03 AC 125 ms
57,836 KB
testcase_04 AC 126 ms
57,836 KB
testcase_05 AC 129 ms
57,972 KB
testcase_06 AC 127 ms
57,828 KB
testcase_07 AC 143 ms
57,848 KB
testcase_08 AC 128 ms
57,964 KB
testcase_09 AC 127 ms
55,900 KB
testcase_10 AC 128 ms
57,704 KB
testcase_11 AC 131 ms
57,960 KB
testcase_12 AC 127 ms
57,856 KB
testcase_13 AC 128 ms
57,960 KB
testcase_14 AC 126 ms
57,840 KB
testcase_15 AC 128 ms
57,816 KB
testcase_16 AC 138 ms
58,088 KB
testcase_17 AC 128 ms
57,840 KB
testcase_18 AC 130 ms
57,948 KB
testcase_19 AC 127 ms
55,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Highway {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        String[] strArray = S.split("");
        int number = 1;
        if (strArray.length == 0) {
            System.out.println(number);
            return;
        }
        for (String s : strArray) {
            if (s.equals("L")) {
                number = number * 2;
            }
            if (s.equals("R")) {
                number = number * 2 + 1;
            }
        }
        System.out.println(number);
    }
}
0