結果

問題 No.104 国道
ユーザー kou6839kou6839
提出日時 2014-12-20 13:04:04
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 410 bytes
コンパイル時間 2,610 ms
コンパイル使用メモリ 71,356 KB
実行使用メモリ 56,356 KB
最終ジャッジ日時 2023-09-02 20:04:56
合計ジャッジ時間 6,187 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,908 KB
testcase_01 AC 113 ms
56,324 KB
testcase_02 AC 116 ms
55,592 KB
testcase_03 RE -
testcase_04 AC 116 ms
56,356 KB
testcase_05 AC 117 ms
55,920 KB
testcase_06 AC 116 ms
55,748 KB
testcase_07 AC 118 ms
55,636 KB
testcase_08 AC 118 ms
56,020 KB
testcase_09 AC 120 ms
55,672 KB
testcase_10 AC 121 ms
56,000 KB
testcase_11 AC 118 ms
55,928 KB
testcase_12 AC 116 ms
55,808 KB
testcase_13 AC 122 ms
55,440 KB
testcase_14 AC 120 ms
56,052 KB
testcase_15 AC 119 ms
55,628 KB
testcase_16 AC 116 ms
55,700 KB
testcase_17 AC 116 ms
56,044 KB
testcase_18 AC 117 ms
55,628 KB
testcase_19 AC 121 ms
55,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("\n");
        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