結果

問題 No.1218 Something Like a Theorem
ユーザー anagohirame
提出日時 2020-07-16 04:24:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 283 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,852 KB
実行使用メモリ 60,924 KB
最終ジャッジ日時 2024-12-17 15:51:54
合計ジャッジ時間 1,494 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n, z = map(int, input().split())
if n == 1:
	if z == 1:
		print(-1)
	else:
		print(1, z-1)
else:
	ok = False
	for x in range(1, z+1):
		for y in range(x, z+1):
			if pow(x, n) + pow(y, n) == pow(z, n):
				print(x, y)
				ok = True
				break
		if ok:
			break
	if not ok:
		print(-1)
0