結果

問題 No.392 2分木をたどれ
ユーザー neko_the_shadowneko_the_shadow
提出日時 2016-11-28 01:02:17
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 5,380 KB
実行使用メモリ 13,152 KB
最終ジャッジ日時 2023-08-18 08:38:30
合計ジャッジ時間 612 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
11,900 KB
testcase_01 AC 26 ms
13,152 KB
testcase_02 AC 26 ms
13,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (solve n)
  (let loop ((x n) (ls '()))
    (if (zero? x)
      (string-join ls "")
      (loop (quotient (- x 1) 2)
            (cons (if (odd? x) "L" "R") ls)))))

(define (MAIN)
  (let loop ((n (string->number (read-line))) (ls '()))
    (if (zero? n)
      (string-join (reverse ls) "\n")
      (loop (- n 1) 
            (cons (solve (string->number (read-line))) ls)))))


(print (MAIN))
0