結果
問題 | No.392 2分木をたどれ |
ユーザー |
|
提出日時 | 2016-10-06 17:10:43 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 527 ms |
使用メモリ | 3,548 KB |
最終ジャッジ日時 | 2022-12-27 08:41:05 |
合計ジャッジ時間 | 1,209 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
3,396 KB |
testcase_01 | AC | 8 ms
3,416 KB |
testcase_02 | AC | 8 ms
3,548 KB |
ソースコード
#include <iostream> #include <cstdint> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int x, y; cin >> x; vector<int> v(x); for (auto& i : v) { cin >> i; } string s; for (size_t i = 0; i < v.size(); i++) { y = v.at(i); while (y > 0) { if (y & 1) { s.push_back('L'); y = (y - 1) / 2; } else { s.push_back('R'); y = (y - 2) / 2; } } reverse(begin(s), end(s)); for (auto j : s) { cout << j; } cout << endl; s.clear(); } return 0; }