結果

問題 No.2228 Creeping Ghost
ユーザー Carpenters-Cat
提出日時 2023-02-24 22:24:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 540 bytes
コンパイル時間 3,948 ms
コンパイル使用メモリ 192,268 KB
最終ジャッジ日時 2025-02-10 21:28:16
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 1 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#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[(i + ans2[j]) % 4];
        }
    }
    for (int j = 0; j < b; j ++) {
        cout << key[(a + ans2[j]) % 4];
    }
    cout << endl;
}
0