結果

問題 No.1218 Something Like a Theorem
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-02-08 10:01:00
言語 Ruby
(3.3.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 232 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 11,400 KB
実行使用メモリ 15,272 KB
最終ジャッジ日時 2023-09-20 03:14:23
合計ジャッジ時間 3,273 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,096 KB
testcase_01 AC 81 ms
15,272 KB
testcase_02 AC 86 ms
15,224 KB
testcase_03 AC 80 ms
15,248 KB
testcase_04 AC 80 ms
15,192 KB
testcase_05 AC 81 ms
15,100 KB
testcase_06 AC 84 ms
15,228 KB
testcase_07 AC 81 ms
15,060 KB
testcase_08 AC 79 ms
15,012 KB
testcase_09 AC 81 ms
15,100 KB
testcase_10 AC 80 ms
15,240 KB
testcase_11 AC 80 ms
14,996 KB
testcase_12 AC 79 ms
15,228 KB
testcase_13 AC 79 ms
15,264 KB
testcase_14 AC 80 ms
15,268 KB
testcase_15 AC 79 ms
15,224 KB
testcase_16 AC 79 ms
15,000 KB
testcase_17 AC 79 ms
15,004 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

hs2={}
1.upto(1000){|i|
	hs2[i*i]=0
}
n,z=gets.split(" ").map{|e| e.to_i}
if z==1 || n>2 then
	puts "No"
elsif n==1 then
	puts "Yes"
else
	z2=z*z
	ans="No"
	hs2.keys.each{|x2|
		t=z2-x2
		ans="Yes" if hs2.member?(t)
	}
	puts ans
end
0