結果

問題 No.104 国道
ユーザー t8m8⛄️
提出日時 2015-03-12 20:54:42
言語 Java
(openjdk 23)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 943 bytes
コンパイル時間 3,683 ms
コンパイル使用メモリ 75,628 KB
実行使用メモリ 37,268 KB
最終ジャッジ日時 2024-06-24 18:43:17
合計ジャッジ時間 5,353 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

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