結果
| 問題 | No.2228 Creeping Ghost |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-24 22:26:49 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 548 bytes |
| 記録 | |
| コンパイル時間 | 1,177 ms |
| コンパイル使用メモリ | 211,112 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-29 17:10:17 |
| 合計ジャッジ時間 | 2,101 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const string key = "URDL";
string ans1 = "RLRD";
int ans2[] = {2, 0, 2, 1};
int main () {
int N;
cin >> N;
if (N <= 4) {
cout << ans1.substr(0, N) << endl;
return 0;
}
cout << ans1;
N -= 4;
int a = N / 4, b = N % 4;
for (int i = 0; i < a; i ++) {
for (int j = 0; j < 4; j ++) {
cout << key[(3 * i + ans2[j]) % 4];
}
}
for (int j = 0; j < b; j ++) {
cout << key[(a * 3 + ans2[j]) % 4];
}
cout << endl;
}