結果

問題 No.1218 Something Like a Theorem
ユーザー takakintakakin
提出日時 2020-09-09 21:55:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,760 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2023-08-22 12:23:20
合計ジャッジ時間 1,727 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,852 KB
testcase_01 AC 17 ms
7,848 KB
testcase_02 AC 16 ms
7,820 KB
testcase_03 AC 15 ms
7,908 KB
testcase_04 AC 15 ms
7,792 KB
testcase_05 AC 15 ms
7,936 KB
testcase_06 AC 16 ms
7,792 KB
testcase_07 AC 15 ms
7,764 KB
testcase_08 AC 16 ms
7,792 KB
testcase_09 AC 15 ms
7,848 KB
testcase_10 AC 15 ms
7,792 KB
testcase_11 AC 15 ms
7,876 KB
testcase_12 AC 15 ms
7,860 KB
testcase_13 AC 15 ms
7,852 KB
testcase_14 AC 15 ms
7,788 KB
testcase_15 AC 15 ms
7,776 KB
testcase_16 AC 15 ms
7,760 KB
testcase_17 AC 16 ms
7,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,z=map(int,input().split())
if n==1:
	if z==1:
		print("No")
	else:
		print("Yes")
elif n>=3:
	print("No")
else:
	zz=int(z**0.5)+1
	A=[int(i)**2 for i in range(1,zz)]
	A=set(A)
	for x in range(1,zz):
		if z-x**2 in A and x**2<z-x**2:
			print("Yes")
			break
		else:
			continue
	else:
		print("No")
0