結果
問題 | No.392 2分木をたどれ |
ユーザー |
|
提出日時 | 2016-10-16 22:27:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 553 bytes |
コンパイル時間 | 1,001 ms |
コンパイル使用メモリ | 75,304 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-22 12:39:16 |
合計ジャッジ時間 | 1,276 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include <iostream>#include <string>#include <vector>#include <algorithm>using namespace std;void solve(vector<string>& v, const int a) {if(a == 0) return;int n = 0;if (a % 2 == 0) {v.push_back("R");} else {v.push_back("L");}n = 0.5 * (a - 1);solve(v, n);}int main () {int m;cin >> m;for (int i = 0; i < m; i++) {int a;cin >> a;vector<string> v;solve(v, a);reverse(v.begin(), v.end());for (string s : v) {cout << s;}cout << endl;}return 0;}