結果

問題 No.104 国道
ユーザー Natsume-MNatsume-M
提出日時 2016-11-28 15:56:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 348 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 71,592 KB
実行使用メモリ 55,620 KB
最終ジャッジ日時 2023-08-18 08:49:29
合計ジャッジ時間 5,473 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
53,308 KB
testcase_01 AC 120 ms
55,400 KB
testcase_02 AC 120 ms
55,516 KB
testcase_03 AC 122 ms
55,324 KB
testcase_04 AC 122 ms
55,388 KB
testcase_05 AC 123 ms
55,304 KB
testcase_06 AC 124 ms
55,408 KB
testcase_07 AC 120 ms
55,620 KB
testcase_08 AC 124 ms
55,108 KB
testcase_09 AC 124 ms
55,320 KB
testcase_10 AC 124 ms
55,156 KB
testcase_11 AC 128 ms
55,596 KB
testcase_12 AC 122 ms
55,092 KB
testcase_13 AC 124 ms
55,320 KB
testcase_14 AC 124 ms
55,528 KB
testcase_15 AC 121 ms
55,104 KB
testcase_16 AC 124 ms
55,312 KB
testcase_17 AC 122 ms
55,588 KB
testcase_18 AC 122 ms
55,108 KB
testcase_19 AC 123 ms
55,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class y104 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int r = 1;
        for (int i=0; i<s.length(); i++) {
	        if (s.charAt(i)=='L')	r*=2;
        	else if (s.charAt(i)=='R')r=r*2+1;
        }
        System.out.println(r);
    }
}
0