結果
問題 |
No.2845 Birthday Pattern in Two Different Calendars
|
ユーザー |
|
提出日時 | 2024-08-24 02:25:21 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 238 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 385 ms |
コンパイル使用メモリ | 82,496 KB |
実行使用メモリ | 102,636 KB |
最終ジャッジ日時 | 2024-08-24 02:25:26 |
合計ジャッジ時間 | 4,382 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 22 |
ソースコード
import math import sys input = sys.stdin.readline T = int(input()) KMN = [list(map(int, input().split())) for _ in range(T)] for k, m, n in KMN: if m-1==0: print("No") continue g = math.gcd(k, m-1) a = [i for i in range(k)] ans = [] for i in range(g): b = [] for j in range(0, k//g): b.append(a[(i+j*(m-1))%k]) for j in range(0, k//g-1, 2): ans.append(b[j]+1) if len(ans)>=n: print("Yes") print(*ans[:n]) else: print("No")