結果
| 問題 |
No.392 2分木をたどれ
|
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2016-06-19 18:37:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 380 bytes |
| コンパイル時間 | 234 ms |
| コンパイル使用メモリ | 34,048 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 05:22:28 |
| 合計ジャッジ時間 | 758 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
24 | scanf("%d",&m);
| ~~~~~^~~~~~~~~
main.cpp:27:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h>
#include<list>
void f(int n){
n++;
std::list<char> li;
while(n>1){
if(n%2==1){
li.push_front('R');
}else{
li.push_front('L');
}
n/=2;
}
std::list<char>::iterator it;
for(it=li.begin();it!=li.end();it++){
printf("%c",(*it));
}
printf("\n");
}
int main(){
int m,n;
scanf("%d",&m);
for(int i=0;i<m;i++){
scanf("%d",&n);
f(n);
}
}
horiesiniti