結果

問題 No.104 国道
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 20:21:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 372 bytes
コンパイル時間 2,017 ms
コンパイル使用メモリ 74,616 KB
実行使用メモリ 42,028 KB
最終ジャッジ日時 2024-04-16 23:21:05
合計ジャッジ時間 5,556 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
41,564 KB
testcase_01 AC 126 ms
41,284 KB
testcase_02 AC 125 ms
41,644 KB
testcase_03 AC 111 ms
41,928 KB
testcase_04 AC 126 ms
41,204 KB
testcase_05 AC 116 ms
41,472 KB
testcase_06 AC 129 ms
41,396 KB
testcase_07 AC 129 ms
41,028 KB
testcase_08 AC 129 ms
41,324 KB
testcase_09 AC 128 ms
41,340 KB
testcase_10 AC 135 ms
42,028 KB
testcase_11 AC 131 ms
41,448 KB
testcase_12 AC 127 ms
41,452 KB
testcase_13 AC 127 ms
41,472 KB
testcase_14 AC 127 ms
41,508 KB
testcase_15 AC 132 ms
41,564 KB
testcase_16 AC 125 ms
41,600 KB
testcase_17 AC 128 ms
41,368 KB
testcase_18 AC 133 ms
41,404 KB
testcase_19 AC 132 ms
41,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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