結果

問題 No.1218 Something Like a Theorem
ユーザー anagohirame
提出日時 2020-07-16 05:11:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 1,825 ms
コンパイル使用メモリ 193,144 KB
最終ジャッジ日時 2025-01-11 21:27:24
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	int n, z; cin >> n >> z;
	if (n > 2) cout << -1 << endl;
	else if (n == 1) {
		if (z == 1) cout << -1 << endl;
		else cout << 1 << " " << z-1 << endl;
	}
	else {
		bool ok = false;
		for (int x = 1; x < z; ++x) {
			for (int y = x; y < z; ++y) {
				if (x*x + y*y == z*z) {
					cout << x << " " << y << endl;
					ok = true;
					break;
				}
			}
			if (ok) break;
		}
		if (!ok) cout << -1 << endl;
	}
	return 0;
}
0