結果
| 問題 |
No.392 2分木をたどれ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-21 12:06:46 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 722 bytes |
| コンパイル時間 | 2,228 ms |
| コンパイル使用メモリ | 60,760 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-01 10:29:01 |
| 合計ジャッジ時間 | 2,633 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
import sequtils
template times*(n:int,body) = (for _ in 0..<n: body)
proc printf(formatstr: cstring){.header: "<stdio.h>", varargs.}
proc putchar_unlocked(c :char) {. importc:"putchar_unlocked",header: "<stdio.h>" .}
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
while true:
let k = getchar_unlocked()
if k < '0': break
result = 10 * result + k.ord - '0'.ord
proc path(n:int) : string =
if n == 0 : return "??"
if n == 1 : return "L"
if n == 2 : return "R"
if n mod 2 == 1: return path(n div 2) & "L"
return path((n-1) div 2) & "R"
const pathes = toSeq(0..4096).mapIt((it.path & "\n").cstring)
let m = scan()
m.times: printf(pathes[scan()])