結果

問題 No.104 国道
ユーザー r.suzuki
提出日時 2016-01-09 21:01:59
言語 Java
(openjdk 23)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 415 bytes
コンパイル時間 3,386 ms
コンパイル使用メモリ 74,528 KB
実行使用メモリ 41,628 KB
最終ジャッジ日時 2024-09-19 13:19:05
合計ジャッジ時間 6,861 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

public class No_104 {

	public static void main(String[] args) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int root = 1;
		if (!sc.hasNext()) {
			System.out.println(root);
			System.exit(0);
		}

		char[] LorR = sc.next().toCharArray();

		for (char c : LorR) {
			if (c == 'L')
				root *= 2;
			else if (c == 'R')
				root = root * 2 + 1;
		}

		System.out.println(root);
		sc.close();

	}

}
0