結果
問題 | No.1218 Something Like a Theorem |
ユーザー |
![]() |
提出日時 | 2020-09-04 21:30:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 359 ms / 2,000 ms |
コード長 | 835 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 80,632 KB |
最終ジャッジ日時 | 2024-11-26 11:58:23 |
合計ジャッジ時間 | 2,274 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
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()