結果

問題 No.2845 Birthday Pattern in Two Different Calendars
ユーザー moon17
提出日時 2024-08-23 23:25:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 405 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 82,012 KB
実行使用メモリ 88,388 KB
最終ジャッジ日時 2024-08-23 23:25:09
合計ジャッジ時間 5,153 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import*
for _ in range(int(input())):
  k,m,n=map(int,input().split())
  if m==1:
    print('No')
    continue
  g=gcd(k,m)
  s=[0]*(k+1)
  t=0
  ans=[]
  i=1
  for _ in range(k):
    j=(i+m-2)%k+1
    if s[i]==s[j]==0:
      s[i]=s[j]=1
      t+=1
      ans+=i,
    i+=g
    if i>k:
      i-=k
    if t==n:
      break
  if t==n:
    print('Yes')
    print(*sorted(ans))
  else:
    print('No')
0