結果

問題 No.104 国道
ユーザー kou6839
提出日時 2014-12-20 13:08:34
言語 Java
(openjdk 23)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 450 bytes
コンパイル時間 4,043 ms
コンパイル使用メモリ 80,240 KB
実行使用メモリ 41,384 KB
最終ジャッジ日時 2024-06-12 02:28:30
合計ジャッジ時間 5,937 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
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);
			return;
		}
        String s = sc.next();
        int ans = 1;
        for(int i=0;i<s.length();i++){
        	if(s.charAt(i)=='L') ans *=2;
        	else if(s.charAt(i)=='R')ans = ans*2+1;
        }
        System.out.println(ans);
    }
}	
0