結果

問題 No.1218 Something Like a Theorem
ユーザー yuruhiyayuruhiya
提出日時 2020-09-05 17:58:13
言語 Ruby
(3.3.0)
結果
AC  
実行時間 430 ms / 2,000 ms
コード長 157 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 11,488 KB
実行使用メモリ 65,880 KB
最終ジャッジ日時 2023-08-19 11:12:10
合計ジャッジ時間 4,672 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
15,312 KB
testcase_01 AC 75 ms
15,304 KB
testcase_02 AC 71 ms
15,272 KB
testcase_03 AC 71 ms
15,000 KB
testcase_04 AC 70 ms
15,096 KB
testcase_05 AC 108 ms
23,268 KB
testcase_06 AC 70 ms
15,084 KB
testcase_07 AC 312 ms
65,880 KB
testcase_08 AC 325 ms
65,660 KB
testcase_09 AC 430 ms
64,648 KB
testcase_10 AC 286 ms
64,520 KB
testcase_11 AC 70 ms
15,068 KB
testcase_12 AC 71 ms
15,312 KB
testcase_13 AC 70 ms
15,228 KB
testcase_14 AC 70 ms
15,236 KB
testcase_15 AC 69 ms
15,312 KB
testcase_16 AC 69 ms
15,004 KB
testcase_17 AC 69 ms
15,240 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, z = gets.split.map &:to_i
r = (1..z).to_a
if n == 1
	puts z >= 2 ? 'Yes' : 'No'
else
	puts r.product(r).find { _1**n + _2**n == z**n } ? 'Yes' : 'No'
end
0