結果

問題 No.104 国道
ユーザー mits58
提出日時 2016-07-02 13:50:11
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 382 bytes
コンパイル時間 2,144 ms
コンパイル使用メモリ 74,072 KB
実行使用メモリ 41,528 KB
最終ジャッジ日時 2024-10-12 00:43:21
合計ジャッジ時間 5,477 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		long ans=1;
		if(!sc.hasNext()){
			System.out.println(ans);
			System.exit(0);
		}
		String str=sc.next();
		for(int i=0;i<str.length();i++){
			if(str.charAt(i)=='L') ans*=2;
			else if(str.charAt(i)=='R') ans=2*ans+1;
		}
		System.out.println(ans);
	}
}
0