結果

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int m;
string find(int x){
    string s;
    while(x!=0){
        int fa=(x-1)/2;
        if(fa*2+1==x)
            s+='L';
        else
            s+='R';
        x=fa;
    }
    reverse(s.begin(),s.end());
    return s;
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>m;
    while(m--){
        int a;
        cin>>a;
        cout<<find(a)<<'\n';
    } 
    return 0;
} 
0