結果

問題 No.104 国道
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-20 17:52:19
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 409 bytes
コンパイル時間 2,209 ms
コンパイル使用メモリ 74,308 KB
実行使用メモリ 54,236 KB
最終ジャッジ日時 2024-05-01 07:56:58
合計ジャッジ時間 5,614 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,584 KB
testcase_01 AC 127 ms
41,204 KB
testcase_02 AC 126 ms
41,808 KB
testcase_03 RE -
testcase_04 AC 128 ms
41,296 KB
testcase_05 AC 128 ms
41,344 KB
testcase_06 AC 129 ms
41,260 KB
testcase_07 AC 131 ms
41,556 KB
testcase_08 AC 128 ms
41,040 KB
testcase_09 AC 127 ms
41,460 KB
testcase_10 AC 136 ms
41,588 KB
testcase_11 AC 133 ms
41,372 KB
testcase_12 AC 130 ms
41,312 KB
testcase_13 AC 128 ms
41,328 KB
testcase_14 AC 130 ms
41,200 KB
testcase_15 AC 127 ms
41,392 KB
testcase_16 AC 123 ms
41,432 KB
testcase_17 AC 127 ms
41,292 KB
testcase_18 AC 128 ms
41,324 KB
testcase_19 AC 129 ms
41,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if(s.isEmpty()) {
			System.out.println(1);
			return;
		}
		int n = s.length();
		int ans = 1;
		for(int i = 0 ; i < n ; i++) {
			if(s.charAt(i) == 'R') {
				ans = ans * 2 + 1;
			} else {
				ans = ans * 2;
			}
		}
		System.out.println(ans);
 	}
}

0