結果

問題 No.392 2分木をたどれ
ユーザー nksk38nksk38
提出日時 2017-07-06 22:15:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 710 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 78,732 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 22:02:55
合計ジャッジ時間 1,130 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 10 ms
5,376 KB
testcase_02 AC 10 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

int main()
{
	int m;
	cin >> m;

	vector<string> v;
		 
	for (int i = 0; i < m; i++) {
		int a;
		string s = "";
		cin >> a;
		while (a != 0) {
			if (a % 2 == 0) {
				s += "R";
				a /= 2;
				a--;
			}else{
				s += "L";
				a /= 2;
			}
		}
		v.push_back(s);
	}

	for (int i = 0; i < v.size(); i++) {
		for (int j = v[i].size() - 1; j >= 0; j--) {
			cout << v[i][j];
		}
		cout << endl;
	}
  return 0;
}
0