結果

問題 No.2845 Birthday Pattern in Two Different Calendars
ユーザー Kude
提出日時 2024-08-23 21:25:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 594 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 94,608 KB
最終ジャッジ日時 2024-08-23 21:25:07
合計ジャッジ時間 4,482 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    k, m, n = map(int, input().split())
    m -= 1
    used = [False] * k
    res = []
    for i in range(k):
        if used[i]:
            continue
        last = -1
        while not used[i]:
            used[i] = True
            if last == -1:
                last = i
            else:
                res.append(last)
                last = -1
            i = (i + m) % k
    if len(res) < n:
        print('No')
    else:
        print('Yes')
        print(*(x + 1 for x in res[:n]))
0