結果
| 問題 |
No.392 2分木をたどれ
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-04-18 17:32:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 525 bytes |
| コンパイル時間 | 843 ms |
| コンパイル使用メモリ | 74,332 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-18 17:32:18 |
| 合計ジャッジ時間 | 1,345 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:16: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | int m;scanf("%d",&m);
| ~~~~~^~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",&x);
| ~~~~~^~~~~~~~~
ソースコード
#include<iostream>
#include<cstdio>
#include<stack>
using namespace std;
int main()
{
int m;scanf("%d",&m);
int x;stack<char>ans;
for(int i=1;i<=m;++i)
{
scanf("%d",&x);
while(x>2)
{
if(x%2==0)ans.push('R');
else ans.push('L');
--x;x/=2;
}
if(x==1)ans.push('L');
else ans.push('R');
while(!ans.empty())
{
cout<<ans.top();
ans.pop();
}
cout<<endl;
}
return 0;
}
vjudge1