結果

問題 No.104 国道
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-03-12 20:54:42
言語 Java19
(openjdk 21)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 943 bytes
コンパイル時間 3,290 ms
コンパイル使用メモリ 72,896 KB
実行使用メモリ 49,768 KB
最終ジャッジ日時 2023-09-07 00:41:57
合計ジャッジ時間 5,405 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,536 KB
testcase_01 AC 42 ms
49,500 KB
testcase_02 AC 41 ms
49,388 KB
testcase_03 AC 42 ms
49,412 KB
testcase_04 AC 42 ms
49,496 KB
testcase_05 AC 42 ms
49,512 KB
testcase_06 AC 42 ms
49,276 KB
testcase_07 AC 41 ms
49,440 KB
testcase_08 AC 41 ms
49,332 KB
testcase_09 AC 42 ms
49,452 KB
testcase_10 AC 42 ms
49,488 KB
testcase_11 AC 41 ms
49,228 KB
testcase_12 AC 41 ms
49,212 KB
testcase_13 AC 43 ms
49,584 KB
testcase_14 AC 45 ms
49,412 KB
testcase_15 AC 41 ms
49,288 KB
testcase_16 AC 41 ms
49,768 KB
testcase_17 AC 40 ms
49,440 KB
testcase_18 AC 43 ms
49,456 KB
testcase_19 AC 43 ms
49,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.104 国道

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No104 {

    static final InputStream in = System.in;
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int ans = 1;
        for (int i=0; i<s.length(); i++) {
            if (s.charAt(i) == 'L') ans *= 2;
            else ans = ans*2 + 1;
        }
        out.println(ans);
    }

    public static void main(String[] args) throws Exception {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        in.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0