結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー mesame3993
提出日時 2021-10-29 21:44:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 796 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 57,856 KB
最終ジャッジ日時 2024-10-07 10:40:00
合計ジャッジ時間 5,057 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 48 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  x, a, y, b = map(int, input().split())
  def factorization(n):
    arr, I = [], []
    tmp = n 
    m = int(-(-n**0.5//1))+1
    for i in range(2, m):
      if tmp % i == 0:
        cnt = 0
        while tmp % i == 0:
          cnt += 1
          tmp //= i
        arr.append([i, cnt])
        I.append(i)
    if tmp != 1:
      arr.append([tmp, 1])
      I.append(tmp)
    if len(arr) == 0:
      arr.append([n, 1])
      I.append(n)
    return I, arr

  xi, X = factorization(x)
  yi, Y = factorization(y)
  xi = set(xi)

  for i in range(len(Y)):
    if yi[i] not in xi:
      print('No')
      exit()
    yy = Y[i][0]
    for j in range(len(X)):
      if yy == X[j][0]:
        if Y[i][1]*b > X[j][1]*a:
          print('No')
          exit()
        break
  print('Yes')
main()
0