結果

問題 No.392 2分木をたどれ
ユーザー tntantntan
提出日時 2016-07-12 13:03:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 2,064 ms
コンパイル使用メモリ 144,336 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-04 17:16:10
合計ジャッジ時間 1,924 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second

string solve(int p)
{
	string s,r;
	while(p!=0)
	{
		if(p%2)
		{
			p=(p-1)/2;
			s+="L";
		}
		else
		{
			p=(p-2)/2;
			s+="R";
		}
	}
	for(int i=s.length()-1;i>=0;i--)r+=s[i];
	return r;
}

int main()
{
	int n,a;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		cout<<solve(a)<<endl;
	}
	return 0;
}
0