結果

問題 No.104 国道
ユーザー ぴろずぴろず
提出日時 2014-12-16 23:31:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 439 bytes
コンパイル時間 2,104 ms
コンパイル使用メモリ 72,540 KB
実行使用メモリ 55,788 KB
最終ジャッジ日時 2023-09-02 15:25:12
合計ジャッジ時間 5,675 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,540 KB
testcase_01 AC 121 ms
55,624 KB
testcase_02 AC 123 ms
55,596 KB
testcase_03 AC 121 ms
55,708 KB
testcase_04 AC 119 ms
55,468 KB
testcase_05 AC 122 ms
55,568 KB
testcase_06 AC 119 ms
55,528 KB
testcase_07 AC 121 ms
55,536 KB
testcase_08 AC 122 ms
55,528 KB
testcase_09 AC 122 ms
55,672 KB
testcase_10 AC 120 ms
55,544 KB
testcase_11 AC 119 ms
55,520 KB
testcase_12 AC 121 ms
55,648 KB
testcase_13 AC 122 ms
55,620 KB
testcase_14 AC 118 ms
55,788 KB
testcase_15 AC 119 ms
55,396 KB
testcase_16 AC 122 ms
55,784 KB
testcase_17 AC 121 ms
55,592 KB
testcase_18 AC 123 ms
55,652 KB
testcase_19 AC 121 ms
55,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no104;

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;
		}
		char[] s = sc.next().toCharArray();
		int n = s.length;
		long x = 1;
		for(int i=0;i<n;i++) {
			if (s[i] == 'L') {
				x = x * 2;
			}else {
				x = x * 2 + 1;
			}
		}
		System.out.println(x);
	}

}
0