結果

問題 No.392 2分木をたどれ
ユーザー noriocnorioc
提出日時 2016-08-12 02:33:19
言語 C#(mono)
(mono 6.12.0.158)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 953 bytes
コンパイル時間 1,789 ms
使用メモリ 18,004 KB
最終ジャッジ日時 2022-12-13 21:55:35
合計ジャッジ時間 2,261 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 58 ms
15,680 KB
testcase_01 AC 73 ms
18,004 KB
testcase_02 AC 75 ms
17,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static string ReadLine() { return Console.ReadLine(); }
    static int ReadInt() { return int.Parse(ReadLine()); }
    static int[] ReadInts() { return ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return ReadLine().Split(); }
    static void Display<T> (IEnumerable<T> xs) { Console.WriteLine(string.Join(" ", xs)); }

    static string Calc(int x) {
        var ans = new List<string>();

        while (x > 0) {
            if (x % 2 == 0) {
                ans.Add("R");
            }
            else {
                ans.Add("L");
            }
            x = (x - 1) / 2;
        }
        return string.Join("", ans.Reverse<>());
    }

    static void Main() {
        int n = ReadInt();
        for (int i = 0; i < n; i++) {
            int x = ReadInt();
            Console.WriteLine(Calc(x));
        }
    }
}
0