結果

問題 No.1585 Cubic Number
ユーザー Kiri8128
提出日時 2021-07-08 22:53:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 1,000 ms
コード長 281 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-07-01 13:43:17
合計ジャッジ時間 2,359 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

def sqrt(n, k = 3):
    if n == 0: return 0
    l = k - 1
    if not n: return 0
    y = 1 << (n.bit_length() + l) // k
    x = y + 1
    while y < x:
        x = y
        y = (l * x + n // (x ** l)) // k
    return x

N = int(input())
print("Yes" if sqrt(N) ** 3 == N else "No")
0