結果

問題 No.104 国道
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-12 07:23:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 705 bytes
コンパイル時間 2,414 ms
コンパイル使用メモリ 74,348 KB
実行使用メモリ 56,108 KB
最終ジャッジ日時 2023-08-17 02:19:34
合計ジャッジ時間 6,016 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,704 KB
testcase_01 AC 126 ms
55,864 KB
testcase_02 AC 128 ms
55,624 KB
testcase_03 AC 121 ms
55,576 KB
testcase_04 AC 125 ms
55,620 KB
testcase_05 AC 125 ms
55,696 KB
testcase_06 AC 124 ms
55,692 KB
testcase_07 AC 122 ms
56,056 KB
testcase_08 AC 117 ms
55,732 KB
testcase_09 AC 113 ms
55,644 KB
testcase_10 AC 115 ms
56,108 KB
testcase_11 AC 110 ms
55,528 KB
testcase_12 AC 126 ms
55,740 KB
testcase_13 AC 127 ms
55,648 KB
testcase_14 AC 128 ms
55,700 KB
testcase_15 AC 127 ms
55,460 KB
testcase_16 AC 124 ms
55,704 KB
testcase_17 AC 126 ms
55,844 KB
testcase_18 AC 126 ms
55,864 KB
testcase_19 AC 126 ms
55,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
        }else{
            String S = sc.next();
            String s [] = S.split("");
            String n = "";
            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