結果

問題 No.104 国道
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-21 22:35:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 354 bytes
コンパイル時間 1,844 ms
コンパイル使用メモリ 74,160 KB
実行使用メモリ 56,120 KB
最終ジャッジ日時 2024-04-10 10:01:32
合計ジャッジ時間 4,975 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
54,036 KB
testcase_01 AC 106 ms
53,004 KB
testcase_02 AC 118 ms
56,120 KB
testcase_03 AC 116 ms
54,136 KB
testcase_04 AC 116 ms
54,116 KB
testcase_05 AC 121 ms
54,100 KB
testcase_06 AC 120 ms
54,252 KB
testcase_07 AC 119 ms
53,836 KB
testcase_08 AC 108 ms
52,996 KB
testcase_09 AC 119 ms
54,152 KB
testcase_10 AC 105 ms
52,700 KB
testcase_11 AC 119 ms
54,040 KB
testcase_12 AC 109 ms
52,748 KB
testcase_13 AC 105 ms
52,800 KB
testcase_14 AC 118 ms
54,588 KB
testcase_15 AC 116 ms
54,032 KB
testcase_16 AC 109 ms
53,620 KB
testcase_17 AC 115 ms
54,052 KB
testcase_18 AC 115 ms
53,996 KB
testcase_19 AC 108 ms
52,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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