結果

問題 No.392 2分木をたどれ
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2017-09-28 13:40:42
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 79,116 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-09 20:37:20
合計ジャッジ時間 1,130 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int m;
    cin >> m;
    
    vector<string> ans;
    
    for ( int i = 0; i < m; i++ ) {
        int A;
        cin >> A;
        
        string S;
        while (A) {
            S += A%2 ? 'L' : 'R';
            A = A%2 ? (A-1)/2 : (A-2)/2;
        }
        reverse( S.begin(), S.end() );
        ans.push_back(S);
    }
    
    for ( auto& a : ans ) { 
        cout << a << endl;
    }
    
    return 0;
}
0