結果

問題 No.104 国道
ユーザー bayashiko_rbayashiko_r
提出日時 2018-11-08 00:04:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 692 bytes
コンパイル時間 4,676 ms
コンパイル使用メモリ 99,728 KB
実行使用メモリ 22,768 KB
最終ジャッジ日時 2023-08-13 04:11:16
合計ジャッジ時間 7,087 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
20,440 KB
testcase_01 AC 51 ms
22,724 KB
testcase_02 AC 51 ms
20,604 KB
testcase_03 AC 50 ms
22,472 KB
testcase_04 AC 50 ms
18,460 KB
testcase_05 AC 51 ms
22,644 KB
testcase_06 AC 51 ms
20,572 KB
testcase_07 AC 50 ms
18,484 KB
testcase_08 AC 49 ms
20,456 KB
testcase_09 AC 50 ms
22,768 KB
testcase_10 AC 50 ms
22,632 KB
testcase_11 AC 51 ms
20,600 KB
testcase_12 AC 50 ms
20,424 KB
testcase_13 AC 50 ms
18,596 KB
testcase_14 AC 50 ms
20,472 KB
testcase_15 AC 50 ms
18,592 KB
testcase_16 AC 50 ms
20,464 KB
testcase_17 AC 51 ms
20,612 KB
testcase_18 AC 51 ms
22,556 KB
testcase_19 AC 50 ms
20,564 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Program {
    static void Main(string[] args) {
        //入力
        string s = Console.ReadLine();
        char[] t = new char[s.Length];
        for (int i = 0; i < s.Length; i++) {
            t[i] = s[i];
        }

        //現在通っている未知の番号
        int road_num = 1;  //はじめは1にいる

        //Lが出たら2倍、Rが出たら2倍+1にする
        for (int i = 0; i < s.Length; i++) {
            if (t[i] == 'L') {
                road_num = road_num * 2;
            } else if (t[i] == 'R') {
                road_num = road_num * 2 + 1;
            }
        }
        //出力
        Console.WriteLine(road_num);
    }
}
0