結果

問題 No.1218 Something Like a Theorem
ユーザー mesame3993mesame3993
提出日時 2021-11-18 21:28:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 210,288 KB
最終ジャッジ日時 2023-08-27 15:46:24
合計ジャッジ時間 5,481 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 313 ms
210,148 KB
testcase_01 AC 71 ms
71,096 KB
testcase_02 AC 64 ms
71,024 KB
testcase_03 AC 64 ms
71,108 KB
testcase_04 AC 67 ms
71,096 KB
testcase_05 AC 75 ms
71,104 KB
testcase_06 AC 331 ms
210,068 KB
testcase_07 AC 308 ms
210,256 KB
testcase_08 AC 264 ms
210,112 KB
testcase_09 AC 337 ms
209,884 KB
testcase_10 AC 262 ms
210,196 KB
testcase_11 AC 311 ms
210,156 KB
testcase_12 AC 264 ms
210,288 KB
testcase_13 AC 65 ms
70,804 KB
testcase_14 AC 66 ms
71,072 KB
testcase_15 AC 64 ms
71,020 KB
testcase_16 AC 63 ms
71,368 KB
testcase_17 AC 65 ms
71,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  readline=stdin.readline
  n,z = map(int, readline().split())
  if n >= 3:
    print('No')
  elif n == 1:
    if z >= 2:
      print('Yes')
    else:
      print('No')
  elif n == 2:
    st = set(y*y for y in range(1, 10**6+1))
    z *= z
    for x in range(1, 10**6+1):
      x *= x
      if z-x in st:
        print('Yes')
        break
    else:
      print('No')
main()
0