結果
問題 | No.392 2分木をたどれ |
ユーザー |
|
提出日時 | 2018-12-06 17:27:16 |
言語 | C (gcc 11.2.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 71 ms |
使用メモリ | 6,284 KB |
最終ジャッジ日時 | 2023-02-26 10:10:55 |
合計ジャッジ時間 | 749 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
6,252 KB |
testcase_01 | AC | 1 ms
6,284 KB |
testcase_02 | AC | 1 ms
6,208 KB |
ソースコード
#include <stdio.h> #include <string.h> int main(void) { char ans[12], tmp; int m, a, top, length, i, j; scanf("%d", &m); for (i = 0; i < m; ++i) { scanf("%d", &a); top = 0; do { if (a % 2) ans[top] = 'L'; else { ans[top] = 'R'; --a; } ++top; } while (a /= 2); ans[top] = '\0'; length = strlen(ans); for (j = 0; j < length / 2; ++j) { tmp = ans[j]; ans[j] = ans[length - j - 1]; ans[length - j - 1] = tmp; } puts(ans); } return 0; }