結果
| 問題 |
No.392 2分木をたどれ
|
| コンテスト | |
| ユーザー |
YoshiRyu
|
| 提出日時 | 2017-01-04 17:17:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 555 bytes |
| コンパイル時間 | 635 ms |
| コンパイル使用メモリ | 45,540 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-17 19:29:00 |
| 合計ジャッジ時間 | 818 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | #define SF(f,v) scanf(f,v)
| ~~~~~^~~~~
main.cpp:14:9: note: in expansion of macro ‘SF’
14 | SF("%d", &m);
| ^~
main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | #define SF(f,v) scanf(f,v)
| ~~~~~^~~~~
main.cpp:23:17: note: in expansion of macro ‘SF’
23 | SF("%d", &calc);
| ^~
ソースコード
#include <cstdio>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(n) REP(i,n)
#define SF(f,v) scanf(f,v)
#define PF(f,v) printf(f,v)
using namespace std;
int main() {
int m;
SF("%d", &m);
rep(m)
{
// 出力用
string ans = "";
// Aの値
int calc;
SF("%d", &calc);
do
{
if ((calc % 2) == 0)
{
ans = "R" + ans;
}
else
{
ans = "L" + ans;
}
// 小数点以下は切り捨てられる
calc = (calc - 1 ) / 2;
} while (calc > 0);
PF("%s\n", ans.c_str());
}
return 0;
}
YoshiRyu