結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,520 KB
testcase_01 AC 128 ms
41,180 KB
testcase_02 AC 130 ms
41,432 KB
testcase_03 RE -
testcase_04 AC 131 ms
41,124 KB
testcase_05 AC 130 ms
41,476 KB
testcase_06 AC 136 ms
41,516 KB
testcase_07 AC 130 ms
41,472 KB
testcase_08 AC 130 ms
41,524 KB
testcase_09 AC 138 ms
41,488 KB
testcase_10 AC 133 ms
41,672 KB
testcase_11 AC 132 ms
41,516 KB
testcase_12 AC 128 ms
41,592 KB
testcase_13 AC 135 ms
41,728 KB
testcase_14 AC 126 ms
41,272 KB
testcase_15 AC 128 ms
41,328 KB
testcase_16 AC 129 ms
41,320 KB
testcase_17 AC 130 ms
41,376 KB
testcase_18 AC 126 ms
41,596 KB
testcase_19 AC 131 ms
41,104 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