結果

問題 No.1585 Cubic Number
ユーザー harurunharurun
提出日時 2021-07-09 00:33:01
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 478 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 82,764 KB
最終ジャッジ日時 2023-09-14 06:12:47
合計ジャッジ時間 4,483 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
72,124 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 83 ms
72,100 KB
testcase_04 AC 84 ms
72,336 KB
testcase_05 AC 84 ms
72,104 KB
testcase_06 AC 88 ms
72,100 KB
testcase_07 AC 90 ms
71,988 KB
testcase_08 AC 81 ms
72,252 KB
testcase_09 AC 84 ms
72,104 KB
testcase_10 AC 80 ms
71,864 KB
testcase_11 AC 83 ms
71,872 KB
testcase_12 AC 88 ms
76,024 KB
testcase_13 AC 87 ms
72,028 KB
testcase_14 AC 87 ms
76,096 KB
testcase_15 AC 85 ms
72,260 KB
testcase_16 AC 85 ms
72,248 KB
testcase_17 AC 83 ms
72,288 KB
testcase_18 AC 88 ms
72,252 KB
testcase_19 AC 84 ms
71,992 KB
testcase_20 AC 84 ms
72,456 KB
testcase_21 AC 98 ms
75,948 KB
testcase_22 AC 84 ms
72,160 KB
testcase_23 AC 87 ms
71,864 KB
testcase_24 AC 86 ms
71,932 KB
testcase_25 AC 96 ms
76,096 KB
testcase_26 AC 89 ms
71,872 KB
testcase_27 AC 89 ms
72,244 KB
testcase_28 AC 86 ms
72,060 KB
testcase_29 AC 87 ms
72,092 KB
testcase_30 AC 86 ms
72,048 KB
権限があれば一括ダウンロードができます

ソースコード

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