結果

問題 No.104 国道
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-20 17:58:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 411 bytes
コンパイル時間 1,883 ms
コンパイル使用メモリ 71,796 KB
実行使用メモリ 56,164 KB
最終ジャッジ日時 2023-08-13 15:05:33
合計ジャッジ時間 5,227 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,004 KB
testcase_01 AC 117 ms
55,608 KB
testcase_02 AC 114 ms
55,680 KB
testcase_03 AC 114 ms
55,580 KB
testcase_04 AC 116 ms
55,976 KB
testcase_05 AC 117 ms
55,968 KB
testcase_06 AC 117 ms
55,912 KB
testcase_07 AC 117 ms
55,848 KB
testcase_08 AC 114 ms
56,004 KB
testcase_09 AC 116 ms
55,728 KB
testcase_10 AC 114 ms
55,460 KB
testcase_11 AC 117 ms
55,976 KB
testcase_12 AC 115 ms
55,616 KB
testcase_13 AC 115 ms
55,956 KB
testcase_14 AC 116 ms
55,776 KB
testcase_15 AC 118 ms
56,164 KB
testcase_16 AC 117 ms
55,808 KB
testcase_17 AC 116 ms
55,784 KB
testcase_18 AC 119 ms
55,964 KB
testcase_19 AC 115 ms
55,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
		}
		String s = sc.next();
		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