結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2016-07-12 00:31:08 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 378 bytes |
コンパイル時間 | 1,317 ms |
使用メモリ | 4,904 KB |
最終ジャッジ日時 | 2022-12-08 16:42:45 |
合計ジャッジ時間 | 1,778 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,900 KB |
testcase_01 | AC | 8 ms
4,904 KB |
testcase_02 | AC | 8 ms
4,900 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; void solve(){ int a; cin >> a; string str; while(a > 0){ if(a % 2 == 0){ a = (a - 2) / 2; str += "R"; }else{ a = (a - 1) / 2; str += "L"; } } reverse(str.begin(), str.end()); cout << str << endl; } int main(){ int m; cin >> m; for(int i = 0; i < m; i++){ solve(); } }