結果
| 問題 | No.1218 Something Like a Theorem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-06-23 18:04:09 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 540 bytes |
| 記録 | |
| コンパイル時間 | 299 ms |
| コンパイル使用メモリ | 85,344 KB |
| 実行使用メモリ | 59,628 KB |
| 最終ジャッジ日時 | 2026-06-23 18:04:13 |
| 合計ジャッジ時間 | 3,221 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
ソースコード
# x,y二重ループでもいけるか?
# xループ+二分探索
# n=1ならば必ず"Yes"でn>=2のみ探索すればよいならx,y二重ループでもいける。
n,z = map(int, input().split())
if n == 1 and z >= 2:
print("Yes")
exit()
smax = z ** n
for x in range(1,smax+1):
if x ** n > smax:
break
for y in range(x,smax+1):
tmp = x ** n + y ** n
if tmp == smax:
print("Yes")
exit()
if tmp > smax:
break
print("No")