結果

問題 No.2228 Creeping Ghost
ユーザー lam6er
提出日時 2025-04-09 21:00:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 543 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,664 KB
実行使用メモリ 134,532 KB
最終ジャッジ日時 2025-04-09 21:01:08
合計ジャッジ時間 2,900 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 1 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

if T < 4:
    # Handle cases where there's no ghost appearance
    sample = "DRU"  # Valid for T=3; adjust if needed for T=1, 2
    print(sample[:T])
else:
    s = ['R', 'D', 'R', 'D']
    remaining = T - 4
    patterns = ['RURU', 'LDLD']
    pattern_idx = 0
    while remaining > 0:
        current_pattern = patterns[pattern_idx % 2]
        take = min(remaining, len(current_pattern))
        for c in current_pattern[:take]:
            s.append(c)
        remaining -= take
        pattern_idx += 1
    print(''.join(s))
0