結果
| 問題 | 
                            No.104 国道
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ぴろず
                         | 
                    
| 提出日時 | 2014-12-16 23:24:28 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 427 bytes | 
| コンパイル時間 | 1,981 ms | 
| コンパイル使用メモリ | 74,388 KB | 
| 実行使用メモリ | 54,348 KB | 
| 最終ジャッジ日時 | 2024-06-11 21:57:24 | 
| 合計ジャッジ時間 | 4,978 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 RE * 1 | 
| other | AC * 16 | 
ソースコード
package no104;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		if (!sc.hasNext()) {
			System.out.println(1);
		}
		char[] s = sc.next().toCharArray();
		int n = s.length;
		long x = 1;
		for(int i=0;i<n;i++) {
			if (s[i] == 'L') {
				x = x * 2;
			}else {
				x = x * 2 + 1;
			}
		}
		System.out.println(x);
	}
}
            
            
            
        
            
ぴろず