結果
問題 | No.392 2分木をたどれ |
ユーザー |
![]() |
提出日時 | 2017-09-30 17:18:36 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 603 ms |
コンパイル使用メモリ | 73,536 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 20:55:33 |
合計ジャッジ時間 | 912 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 |
ソースコード
#include <iostream>#include <random>#include <algorithm>#define INF 1000000000using namespace std;// #define int long longsigned main(){int D[]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192};int M;cin >> M;int A;for(int i=0;i<M;i++){cin >> A;int c=0,j=1;while(c<=A){c+=D[j];j++;}j--;c-=D[j];A-=c; // Aが j 行目においての左からの番号になる。ハズ。if(A==0){A=D[j+1];j--;}else A--;for(int k=j;k>0;k--){if(A/D[k-1]){cout << "R";A-=D[k-1];}else cout << "L";}cout << endl;}}