結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
41,208 KB
testcase_01 AC 132 ms
41,428 KB
testcase_02 AC 130 ms
41,184 KB
testcase_03 RE -
testcase_04 AC 134 ms
41,332 KB
testcase_05 AC 129 ms
41,268 KB
testcase_06 AC 130 ms
41,204 KB
testcase_07 AC 137 ms
41,256 KB
testcase_08 AC 125 ms
41,376 KB
testcase_09 AC 127 ms
41,136 KB
testcase_10 AC 128 ms
41,120 KB
testcase_11 AC 129 ms
41,476 KB
testcase_12 AC 128 ms
41,324 KB
testcase_13 AC 132 ms
41,128 KB
testcase_14 AC 132 ms
41,064 KB
testcase_15 AC 126 ms
41,104 KB
testcase_16 AC 123 ms
41,104 KB
testcase_17 AC 128 ms
41,288 KB
testcase_18 AC 129 ms
41,312 KB
testcase_19 AC 127 ms
41,260 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(sc.hasNext()) {
			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