結果

問題 No.104 国道
ユーザー kou6839kou6839
提出日時 2014-12-20 13:08:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 450 bytes
コンパイル時間 2,282 ms
コンパイル使用メモリ 71,816 KB
実行使用メモリ 57,900 KB
最終ジャッジ日時 2023-09-02 20:05:54
合計ジャッジ時間 5,690 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,936 KB
testcase_01 AC 118 ms
55,704 KB
testcase_02 AC 116 ms
55,624 KB
testcase_03 AC 117 ms
55,780 KB
testcase_04 AC 116 ms
56,264 KB
testcase_05 AC 116 ms
55,688 KB
testcase_06 AC 116 ms
55,752 KB
testcase_07 AC 117 ms
56,064 KB
testcase_08 AC 118 ms
55,576 KB
testcase_09 AC 119 ms
56,360 KB
testcase_10 AC 118 ms
55,644 KB
testcase_11 AC 118 ms
57,900 KB
testcase_12 AC 119 ms
55,672 KB
testcase_13 AC 120 ms
55,772 KB
testcase_14 AC 117 ms
55,764 KB
testcase_15 AC 117 ms
55,756 KB
testcase_16 AC 117 ms
55,712 KB
testcase_17 AC 117 ms
55,828 KB
testcase_18 AC 120 ms
56,220 KB
testcase_19 AC 119 ms
55,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

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 ans = 1;
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='L') ans *=2;
        	else if(s.charAt(i)=='R')ans = ans*2+1;
        }
        System.out.println(ans);
    }
}	
0