結果

問題 No.104 国道
ユーザー r.suzukir.suzuki
提出日時 2016-01-09 21:01:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 415 bytes
コンパイル時間 3,399 ms
コンパイル使用メモリ 74,936 KB
実行使用メモリ 57,644 KB
最終ジャッジ日時 2023-10-19 16:59:06
合計ジャッジ時間 6,860 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
57,440 KB
testcase_01 AC 130 ms
57,244 KB
testcase_02 AC 127 ms
57,512 KB
testcase_03 AC 135 ms
57,592 KB
testcase_04 AC 127 ms
57,520 KB
testcase_05 AC 126 ms
57,460 KB
testcase_06 AC 125 ms
57,444 KB
testcase_07 AC 128 ms
57,644 KB
testcase_08 AC 128 ms
57,504 KB
testcase_09 AC 128 ms
57,472 KB
testcase_10 AC 129 ms
57,476 KB
testcase_11 AC 129 ms
57,456 KB
testcase_12 AC 128 ms
57,484 KB
testcase_13 AC 129 ms
57,480 KB
testcase_14 AC 130 ms
57,472 KB
testcase_15 AC 131 ms
57,396 KB
testcase_16 AC 129 ms
57,472 KB
testcase_17 AC 129 ms
57,604 KB
testcase_18 AC 128 ms
56,224 KB
testcase_19 AC 130 ms
57,580 KB
権限があれば一括ダウンロードができます

ソースコード

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