結果
| 問題 | 
                            No.2845 Birthday Pattern in Two Different Calendars
                             | 
                    
| コンテスト | |
| ユーザー | 
                             遭難者
                         | 
                    
| 提出日時 | 2024-06-10 08:51:10 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 501 ms / 2,000 ms | 
| コード長 | 532 bytes | 
| コンパイル時間 | 303 ms | 
| コンパイル使用メモリ | 82,412 KB | 
| 実行使用メモリ | 101,068 KB | 
| 最終ジャッジ日時 | 2025-01-01 17:45:50 | 
| 合計ジャッジ時間 | 4,438 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge7 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 22 | 
ソースコード
for _ in range(int(input())):
    k, m, n = map(int, input().split())
    c = [False] * k
    ans = []
    for st in range(k):
        if c[st]:
            continue
        loop = []
        now = st
        while True:
            loop.append(now)
            c[now] = True
            now = (now + m - 1) % k
            if now == st:
                break
        for i in range(1, len(loop), 2):
            ans.append(loop[i] + 1)
    if len(ans) < n:
        print("No")
    else:
        print("Yes")
        print(*ans[:n])
            
            
            
        
            
遭難者