結果

問題 No.104 国道
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-27 21:56:59
言語 Java19
(openjdk 21)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 571 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 71,336 KB
実行使用メモリ 49,704 KB
最終ジャッジ日時 2023-10-11 16:10:41
合計ジャッジ時間 3,789 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,352 KB
testcase_01 AC 41 ms
49,140 KB
testcase_02 AC 42 ms
49,132 KB
testcase_03 AC 42 ms
49,384 KB
testcase_04 AC 43 ms
49,136 KB
testcase_05 AC 43 ms
49,520 KB
testcase_06 AC 43 ms
49,292 KB
testcase_07 AC 44 ms
49,144 KB
testcase_08 AC 42 ms
49,124 KB
testcase_09 AC 43 ms
49,704 KB
testcase_10 AC 43 ms
49,140 KB
testcase_11 AC 44 ms
49,116 KB
testcase_12 AC 43 ms
49,136 KB
testcase_13 AC 43 ms
47,028 KB
testcase_14 AC 43 ms
49,124 KB
testcase_15 AC 44 ms
49,048 KB
testcase_16 AC 44 ms
49,124 KB
testcase_17 AC 44 ms
49,392 KB
testcase_18 AC 43 ms
49,212 KB
testcase_19 AC 43 ms
49,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String S = reader.readLine();
        int route = 1;
        for (int i = 0; i < S.length(); i++) {
            if (S.charAt(i) == 'L') {
                route = route * 2;
            } else {
                route = route * 2 +1;
            }
        }
        System.out.println(route);
    }
}
0