結果

問題 No.104 国道
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-12 07:16:01
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 695 bytes
コンパイル時間 5,074 ms
コンパイル使用メモリ 74,000 KB
実行使用メモリ 56,052 KB
最終ジャッジ日時 2023-08-17 02:13:42
合計ジャッジ時間 8,767 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,452 KB
testcase_01 AC 125 ms
56,048 KB
testcase_02 AC 125 ms
55,716 KB
testcase_03 RE -
testcase_04 AC 127 ms
55,432 KB
testcase_05 AC 126 ms
55,708 KB
testcase_06 AC 126 ms
55,432 KB
testcase_07 AC 125 ms
55,836 KB
testcase_08 AC 124 ms
55,644 KB
testcase_09 AC 127 ms
56,052 KB
testcase_10 AC 129 ms
55,844 KB
testcase_11 AC 123 ms
55,908 KB
testcase_12 AC 126 ms
55,672 KB
testcase_13 AC 125 ms
55,552 KB
testcase_14 AC 128 ms
55,728 KB
testcase_15 AC 125 ms
55,996 KB
testcase_16 AC 126 ms
55,684 KB
testcase_17 AC 127 ms
55,600 KB
testcase_18 AC 124 ms
55,720 KB
testcase_19 AC 131 ms
55,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String s [] = S.split("");
        String n = "";
        if( "".equals(s[0]) ){
            System.out.println(1);
        }else{
            for(int i=0; i<s.length; i++){
                if( "R".equals(s[i]) ){
                    n = n + "1";
                }else if( "L".equals(s[i]) ){
                    n = n + "0";
                }
            }
            int a = Integer.parseInt(n, 2);
            int b = (int)Math.pow(2,s.length);
            int r = a+b;
            System.out.println(r);
        }
    }
}
0