結果

問題 No.104 国道
ユーザー abc
提出日時 2016-11-04 11:51:23
言語 Java
(openjdk 23)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 505 bytes
コンパイル時間 2,050 ms
コンパイル使用メモリ 74,340 KB
実行使用メモリ 54,304 KB
最終ジャッジ日時 2024-11-25 02:31:27
合計ジャッジ時間 5,437 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

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