結果

問題 No.392 2分木をたどれ
ユーザー vjudge1
提出日時 2025-04-18 16:07:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 588 bytes
コンパイル時間 1,183 ms
コンパイル使用メモリ 162,888 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-18 16:07:22
合計ジャッジ時間 1,763 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
int const N=1e6+5;
int n,m,sum,cnt,t,ans;
signed main()
{
//	freopen("path.in","r",stdin);
//	freopen("path.out","r",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
    cin>>t;
    while(t--)
    {
    	cin>>n;
    	vector<char> a;
    	while(n>=1)
    	{
    	//	n/=2;
    		if(n%2==1)
			{
				a.push_back('L');
				n=(n-1)/2;
			   }   
    		else
			{
				a.push_back('R');
				n=(n-2)/2;
			 } 
    	//	n/=2;
		}
		for(int i=a.size()-1;i>=0;i--)
		{
			cout<<a[i];
			}    
		cout<<'\n';
	}
	return 0;
}
0