結果
問題 |
No.2845 Birthday Pattern in Two Different Calendars
|
ユーザー |
|
提出日時 | 2024-08-23 21:32:06 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 556 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 82,036 KB |
実行使用メモリ | 88,148 KB |
最終ジャッジ日時 | 2024-08-23 21:32:10 |
合計ジャッジ時間 | 4,067 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 WA * 1 |
ソースコード
from math import gcd def solve(): k, m, n = map(int, input().split()) m -= 1 g = gcd(k, m) ma = (k // g) // 2 * 2 * g if ma < 2 * n: print("No") return print("Yes") used = [False] * k A = [] for i in range(k): if used[i]: continue x = i while not used[x] and not used[(x + m) % k]: A.append(x + 1) used[x] = True used[(x + m) % k] = True x = (x + m * 2) % k print(*A) for _ in range(int(input())): solve()