結果

問題 No.104 国道
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-07 14:27:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 559 bytes
コンパイル時間 3,653 ms
コンパイル使用メモリ 72,400 KB
実行使用メモリ 56,488 KB
最終ジャッジ日時 2023-09-17 15:42:16
合計ジャッジ時間 7,647 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,192 KB
testcase_01 AC 123 ms
55,836 KB
testcase_02 AC 123 ms
56,052 KB
testcase_03 AC 123 ms
55,852 KB
testcase_04 AC 122 ms
55,744 KB
testcase_05 AC 123 ms
55,912 KB
testcase_06 AC 120 ms
55,828 KB
testcase_07 AC 124 ms
56,488 KB
testcase_08 AC 122 ms
55,860 KB
testcase_09 AC 123 ms
55,888 KB
testcase_10 AC 124 ms
55,844 KB
testcase_11 AC 123 ms
55,668 KB
testcase_12 AC 123 ms
55,640 KB
testcase_13 AC 126 ms
55,732 KB
testcase_14 AC 122 ms
55,520 KB
testcase_15 AC 122 ms
56,076 KB
testcase_16 AC 124 ms
56,020 KB
testcase_17 AC 122 ms
56,180 KB
testcase_18 AC 121 ms
56,424 KB
testcase_19 AC 123 ms
55,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        String a = koko.nextLine();
        int now=1;
        if(a.length()==0){
            now = 1;
        }else{
           char[] b = a.toCharArray();
           for(int i=0; i<b.length; i++){
               if(b[i]=='L'){
                   now = now*2;
               }else{
                   now = 1+now*2;
               }
            } 
        }
        
        System.out.println(now);
    }
}
0