結果

問題 No.104 国道
ユーザー abcabc
提出日時 2016-11-04 11:51:23
言語 Java19
(openjdk 21)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 2,512 ms
コンパイル使用メモリ 71,116 KB
実行使用メモリ 56,052 KB
最終ジャッジ日時 2023-08-16 13:24:23
合計ジャッジ時間 5,603 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,612 KB
testcase_01 AC 117 ms
55,336 KB
testcase_02 AC 121 ms
55,692 KB
testcase_03 AC 130 ms
55,748 KB
testcase_04 AC 118 ms
55,472 KB
testcase_05 AC 119 ms
55,544 KB
testcase_06 AC 117 ms
55,328 KB
testcase_07 AC 118 ms
55,480 KB
testcase_08 AC 117 ms
55,696 KB
testcase_09 AC 118 ms
55,544 KB
testcase_10 AC 121 ms
55,660 KB
testcase_11 AC 118 ms
55,416 KB
testcase_12 AC 117 ms
55,288 KB
testcase_13 AC 119 ms
55,752 KB
testcase_14 AC 120 ms
53,228 KB
testcase_15 AC 118 ms
55,760 KB
testcase_16 AC 119 ms
55,808 KB
testcase_17 AC 119 ms
55,240 KB
testcase_18 AC 117 ms
55,240 KB
testcase_19 AC 119 ms
56,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        if (!sc.hasNext()) {
            System.out.println(1);
            return;
        }

        String route = sc.next();

        int road = 1;

        for (int i = 0; i < route.length(); i++) {

            road *= 2;

            if (route.charAt(i) == 'R') {
                road++;
            }

        }

        System.out.println(road);

    }

}
0