結果

問題 No.1218 Something Like a Theorem
ユーザー simansiman
提出日時 2020-10-31 14:29:23
言語 Ruby
(3.3.0)
結果
AC  
実行時間 391 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 11,232 KB
実行使用メモリ 15,404 KB
最終ジャッジ日時 2023-09-29 10:25:03
合計ジャッジ時間 3,466 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,240 KB
testcase_01 AC 85 ms
15,224 KB
testcase_02 AC 83 ms
15,248 KB
testcase_03 AC 82 ms
15,000 KB
testcase_04 AC 83 ms
15,120 KB
testcase_05 AC 391 ms
15,112 KB
testcase_06 AC 84 ms
15,148 KB
testcase_07 AC 130 ms
15,240 KB
testcase_08 AC 146 ms
15,224 KB
testcase_09 AC 249 ms
15,288 KB
testcase_10 AC 109 ms
15,084 KB
testcase_11 AC 86 ms
15,164 KB
testcase_12 AC 83 ms
15,084 KB
testcase_13 AC 84 ms
15,360 KB
testcase_14 AC 83 ms
15,244 KB
testcase_15 AC 83 ms
15,404 KB
testcase_16 AC 84 ms
15,228 KB
testcase_17 AC 83 ms
15,280 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, Z = gets.split.map(&:to_i)

s = 1
t = 1

while s ** N < Z ** N
  s += 1
end

while t ** N < Z ** N
  t += 1
end

1.upto(s) do |x|
  1.upto(t) do |y|
    if x ** N + y ** N == Z ** N
      puts 'Yes'
      exit
    end
  end
end

puts 'No'
0