結果

問題 No.1218 Something Like a Theorem
ユーザー toyuzukotoyuzuko
提出日時 2020-09-05 16:23:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 10,588 KB
実行使用メモリ 8,280 KB
最終ジャッジ日時 2023-08-19 06:44:45
合計ジャッジ時間 1,735 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,268 KB
testcase_01 AC 18 ms
8,088 KB
testcase_02 AC 16 ms
8,132 KB
testcase_03 AC 16 ms
8,164 KB
testcase_04 AC 16 ms
8,216 KB
testcase_05 AC 15 ms
8,088 KB
testcase_06 AC 15 ms
8,268 KB
testcase_07 AC 54 ms
8,268 KB
testcase_08 AC 68 ms
8,184 KB
testcase_09 AC 152 ms
8,176 KB
testcase_10 AC 36 ms
8,212 KB
testcase_11 AC 15 ms
8,136 KB
testcase_12 AC 16 ms
8,112 KB
testcase_13 AC 16 ms
8,280 KB
testcase_14 AC 16 ms
8,264 KB
testcase_15 AC 16 ms
8,256 KB
testcase_16 AC 15 ms
8,176 KB
testcase_17 AC 15 ms
8,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
N, Z = map(int, input().split())
if N == 1:
    if Z > 1:
        print('Yes')
    else:
        print('No')
else:
    Z **= N
    k = 1
    A = []
    while k**N <= Z:
        A.append(k**N)
        k += 1
    for a, b in product(A, A):
        if a + b == Z:
            print('Yes')
            break
    else:
        print('No')
0