結果

問題 No.2358 xy+yz+zx=N
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-06-23 22:11:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 496 bytes
コンパイル時間 2,175 ms
コンパイル使用メモリ 204,180 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 10:09:55
合計ジャッジ時間 6,179 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main () {
	using ll = long long;
	ll N;
	cin >> N;
	std::vector<tuple<ll ,ll, ll>> A;
	for (ll x = 0; x * x <= N; x ++) {
		ll mx = (x ? N / x : N);
		for (ll y = x; y <= mx; y ++) {
			ll z = (N - x * y) / (x + y);
			if (x * y + y * z + z * x == N) {
				A.emplace_back(x, y, z);
				if (x < y) {
					A.emplace_back(y, x, z);
				}
			}
		}
	}
	cout << A.size() << endl;
	for (auto& [a, b, c] : A) {
		printf("%lld %lld %lld\n", a, b, c);
	}
}
0