結果

問題 No.1585 Cubic Number
ユーザー harurun
提出日時 2021-07-09 00:33:01
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 478 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,088 KB
実行使用メモリ 67,716 KB
最終ジャッジ日時 2024-07-01 13:46:33
合計ジャッジ時間 2,461 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from random import randint
from math import gcd
def is_prime(x):
  j=0
  while j<40:
    r=randint(2,x-1)
    if gcd(r,x)!=1:
      continue
    if pow(r,x-1,x)!=1:
      return False
    j+=1
  return True

def main():
  N=int(input())
  if is_prime(N):
    print("No")
    return
  if N==1:
    print("Yes")
    return
  i=2
  while N>1:
    cnt=0
    while N%i==0:
      N//=i
      cnt+=1
    if cnt%3:
      print("No")
      return
    i+=1
  print("Yes")
  return
main()
0