結果

問題 No.104 国道
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-20 17:49:20
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 410 bytes
コンパイル時間 2,091 ms
コンパイル使用メモリ 74,404 KB
実行使用メモリ 54,208 KB
最終ジャッジ日時 2024-11-21 10:48:34
合計ジャッジ時間 5,596 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
53,840 KB
testcase_01 AC 120 ms
54,032 KB
testcase_02 AC 109 ms
52,732 KB
testcase_03 RE -
testcase_04 AC 119 ms
53,936 KB
testcase_05 AC 122 ms
53,920 KB
testcase_06 AC 113 ms
52,696 KB
testcase_07 AC 111 ms
53,008 KB
testcase_08 AC 120 ms
54,208 KB
testcase_09 AC 119 ms
54,016 KB
testcase_10 AC 117 ms
53,904 KB
testcase_11 AC 119 ms
53,968 KB
testcase_12 AC 118 ms
53,932 KB
testcase_13 AC 119 ms
53,944 KB
testcase_14 AC 110 ms
52,860 KB
testcase_15 AC 119 ms
53,976 KB
testcase_16 AC 121 ms
53,836 KB
testcase_17 AC 120 ms
53,720 KB
testcase_18 AC 122 ms
53,848 KB
testcase_19 AC 119 ms
53,844 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();
		int n = s.length();
		if(s.equals("")) {
			System.out.println(1);
			return;
		}
		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