結果

問題 No.104 国道
ユーザー mits58mits58
提出日時 2016-07-02 13:50:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 382 bytes
コンパイル時間 2,340 ms
コンパイル使用メモリ 74,436 KB
実行使用メモリ 41,520 KB
最終ジャッジ日時 2024-04-20 05:41:51
合計ジャッジ時間 5,850 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
41,340 KB
testcase_01 AC 131 ms
41,208 KB
testcase_02 AC 128 ms
41,052 KB
testcase_03 AC 143 ms
41,448 KB
testcase_04 AC 129 ms
41,404 KB
testcase_05 AC 123 ms
41,424 KB
testcase_06 AC 133 ms
41,156 KB
testcase_07 AC 133 ms
41,392 KB
testcase_08 AC 129 ms
41,404 KB
testcase_09 AC 135 ms
40,996 KB
testcase_10 AC 113 ms
41,128 KB
testcase_11 AC 127 ms
41,488 KB
testcase_12 AC 124 ms
41,216 KB
testcase_13 AC 135 ms
41,088 KB
testcase_14 AC 129 ms
41,252 KB
testcase_15 AC 141 ms
41,180 KB
testcase_16 AC 139 ms
41,340 KB
testcase_17 AC 136 ms
41,024 KB
testcase_18 AC 134 ms
41,240 KB
testcase_19 AC 133 ms
41,520 KB
権限があれば一括ダウンロードができます

ソースコード

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