結果
問題 | No.2228 Creeping Ghost |
ユーザー |
|
提出日時 | 2023-02-24 22:26:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 548 bytes |
コンパイル時間 | 2,110 ms |
コンパイル使用メモリ | 194,616 KB |
最終ジャッジ日時 | 2025-02-10 21:30:21 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;}