結果

問題 No.104 国道
ユーザー eagleeagle
提出日時 2022-06-15 14:18:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 5,000 ms
コード長 427 bytes
コンパイル時間 2,474 ms
コンパイル使用メモリ 74,948 KB
実行使用メモリ 54,496 KB
最終ジャッジ日時 2024-04-14 22:46:00
合計ジャッジ時間 6,234 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
54,188 KB
testcase_01 AC 134 ms
54,032 KB
testcase_02 AC 133 ms
54,232 KB
testcase_03 AC 134 ms
54,208 KB
testcase_04 AC 132 ms
54,108 KB
testcase_05 AC 132 ms
54,032 KB
testcase_06 AC 135 ms
54,328 KB
testcase_07 AC 142 ms
54,496 KB
testcase_08 AC 135 ms
53,956 KB
testcase_09 AC 137 ms
54,108 KB
testcase_10 AC 134 ms
53,832 KB
testcase_11 AC 136 ms
54,240 KB
testcase_12 AC 135 ms
53,996 KB
testcase_13 AC 134 ms
54,224 KB
testcase_14 AC 131 ms
54,080 KB
testcase_15 AC 133 ms
53,896 KB
testcase_16 AC 136 ms
54,176 KB
testcase_17 AC 134 ms
54,212 KB
testcase_18 AC 132 ms
54,196 KB
testcase_19 AC 135 ms
54,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//分岐の方向
		String S = sc.nextLine();
		long rute = 1;
		for(int i = 0; i < S.length(); i++) {
			char c = S.charAt(i);
			if(c == 'L') {
				rute = rute * 2;
			} else {
				rute = rute * 2 + 1;
			}
		}
		System.out.println(rute);
	}
}
0