結果

問題 No.1218 Something Like a Theorem
ユーザー donutholedonuthole
提出日時 2020-09-04 21:30:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 331 ms / 2,000 ms
コード長 835 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 80,608 KB
最終ジャッジ日時 2024-05-04 21:37:16
合計ジャッジ時間 2,164 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
11,648 KB
testcase_01 AC 31 ms
11,520 KB
testcase_02 AC 331 ms
80,604 KB
testcase_03 AC 186 ms
80,492 KB
testcase_04 AC 183 ms
80,608 KB
testcase_05 AC 184 ms
80,516 KB
testcase_06 AC 30 ms
11,520 KB
testcase_07 AC 30 ms
11,520 KB
testcase_08 AC 29 ms
11,520 KB
testcase_09 AC 29 ms
11,520 KB
testcase_10 AC 29 ms
11,520 KB
testcase_11 AC 28 ms
11,648 KB
testcase_12 AC 29 ms
11,520 KB
testcase_13 AC 28 ms
11,648 KB
testcase_14 AC 30 ms
11,520 KB
testcase_15 AC 29 ms
11,648 KB
testcase_16 AC 30 ms
11,648 KB
testcase_17 AC 29 ms
11,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import collections
import bisect
import itertools
import decimal
import copy

# import numpy as np

# sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===


def main():
    n, z = ns()
    zn = pow(z, n)
    lim = int((10 ** 6) ** (1 / n) + 1)
    items = {pow(i, n) for i in range(1, lim)}

    flg = False
    for i in range(1, lim):
        tgt = zn - pow(i, n)
        if tgt in items:
            flg = True
            break

    print("Yes" if flg else "No")


if __name__ == '__main__':
    main()
0