結果

問題 No.1585 Cubic Number
ユーザー harurunharurun
提出日時 2021-07-09 00:34:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 106 ms / 1,000 ms
コード長 478 bytes
コンパイル時間 1,268 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 76,148 KB
最終ジャッジ日時 2023-09-14 06:12:53
合計ジャッジ時間 4,535 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
72,208 KB
testcase_01 AC 90 ms
71,968 KB
testcase_02 AC 91 ms
72,216 KB
testcase_03 AC 88 ms
71,752 KB
testcase_04 AC 92 ms
72,184 KB
testcase_05 AC 87 ms
72,016 KB
testcase_06 AC 89 ms
71,996 KB
testcase_07 AC 88 ms
72,184 KB
testcase_08 AC 90 ms
71,928 KB
testcase_09 AC 91 ms
72,328 KB
testcase_10 AC 91 ms
71,936 KB
testcase_11 AC 91 ms
71,756 KB
testcase_12 AC 93 ms
76,148 KB
testcase_13 AC 93 ms
72,096 KB
testcase_14 AC 97 ms
76,036 KB
testcase_15 AC 93 ms
72,148 KB
testcase_16 AC 93 ms
72,276 KB
testcase_17 AC 94 ms
72,092 KB
testcase_18 AC 93 ms
71,760 KB
testcase_19 AC 93 ms
72,216 KB
testcase_20 AC 95 ms
72,096 KB
testcase_21 AC 106 ms
76,004 KB
testcase_22 AC 94 ms
72,112 KB
testcase_23 AC 94 ms
72,028 KB
testcase_24 AC 92 ms
72,196 KB
testcase_25 AC 97 ms
76,080 KB
testcase_26 AC 94 ms
71,864 KB
testcase_27 AC 91 ms
71,988 KB
testcase_28 AC 89 ms
72,056 KB
testcase_29 AC 90 ms
72,100 KB
testcase_30 AC 90 ms
71,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from random import randint
from math import gcd
def is_prime(x):
  j=0
  while j<40:
    r=randint(1,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 N==1:
    print("Yes")
    return
  if is_prime(N):
    print("No")
    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