結果

問題 No.104 国道
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-12 07:16:01
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 695 bytes
コンパイル時間 2,696 ms
コンパイル使用メモリ 77,476 KB
実行使用メモリ 41,596 KB
最終ジャッジ日時 2024-05-04 09:26:22
合計ジャッジ時間 6,550 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,464 KB
testcase_01 AC 119 ms
40,396 KB
testcase_02 AC 136 ms
41,312 KB
testcase_03 RE -
testcase_04 AC 133 ms
40,284 KB
testcase_05 AC 135 ms
41,424 KB
testcase_06 AC 134 ms
41,232 KB
testcase_07 AC 137 ms
41,460 KB
testcase_08 AC 136 ms
41,040 KB
testcase_09 AC 137 ms
41,536 KB
testcase_10 AC 139 ms
41,424 KB
testcase_11 AC 137 ms
41,276 KB
testcase_12 AC 136 ms
41,400 KB
testcase_13 AC 135 ms
41,384 KB
testcase_14 AC 133 ms
41,460 KB
testcase_15 AC 139 ms
41,144 KB
testcase_16 AC 136 ms
41,596 KB
testcase_17 AC 138 ms
41,432 KB
testcase_18 AC 133 ms
41,324 KB
testcase_19 AC 135 ms
41,292 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