結果

問題 No.104 国道
ユーザー kazapyon27kazapyon27
提出日時 2017-06-18 22:56:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 483 bytes
コンパイル時間 3,209 ms
コンパイル使用メモリ 74,476 KB
実行使用メモリ 50,372 KB
最終ジャッジ日時 2024-04-09 20:17:08
合計ジャッジ時間 4,877 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
50,236 KB
testcase_01 AC 49 ms
50,324 KB
testcase_02 AC 48 ms
50,056 KB
testcase_03 AC 48 ms
50,284 KB
testcase_04 AC 48 ms
50,052 KB
testcase_05 AC 48 ms
50,292 KB
testcase_06 AC 49 ms
50,236 KB
testcase_07 AC 50 ms
50,352 KB
testcase_08 AC 52 ms
50,052 KB
testcase_09 AC 50 ms
50,292 KB
testcase_10 AC 50 ms
50,372 KB
testcase_11 AC 49 ms
50,256 KB
testcase_12 AC 51 ms
50,292 KB
testcase_13 AC 50 ms
50,252 KB
testcase_14 AC 49 ms
49,936 KB
testcase_15 AC 49 ms
50,296 KB
testcase_16 AC 48 ms
49,952 KB
testcase_17 AC 49 ms
50,292 KB
testcase_18 AC 50 ms
50,260 KB
testcase_19 AC 48 ms
50,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*No.104 国道*/
import java.io.*;
public class No104 {
	public static void main(String[] args) {
		try(BufferedReader input =new BufferedReader(new InputStreamReader(System.in))){
			String route =input.readLine();
			int walkway=1;
			for(byte i=0;i<route.length();i++){
				if(route.charAt(i)=='L'){
					walkway*=2;
				}else if(route.charAt(i)=='R'){
					walkway=2*walkway+1;
				}
			}
			System.out.println(walkway);
		}catch(Exception e){
			e.printStackTrace();
		}		
	}
}
0