結果
| 問題 | 
                            No.104 国道
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-04-14 11:33:47 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 611 bytes | 
| コンパイル時間 | 12,281 ms | 
| コンパイル使用メモリ | 380,856 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-17 12:00:15 | 
| 合計ジャッジ時間 | 13,268 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 4 | 
| other | WA * 16 | 
ソースコード
use std::io::stdin;
/// エントリポイント
fn main() {
    let input = read_lines();
    println!("{}", national_highway(input));
}
/// 標準入力から文字列を取得します。
fn read_lines() -> String {
    let mut str1 = String::new();
    stdin().read_line(&mut str1).unwrap();
    str1
}
/// 国道何号線を歩いているかを返します。
fn national_highway(right_left: String) -> i32 {
    let mut road = 1;
    for s in right_left.as_str().chars() {
        if s == 'L' {
            road = road * 2;
        } else {
            road = road * 2 + 1;
        }
    }
    road
}