結果

問題 No.2358 xy+yz+zx=N
ユーザー elphe
提出日時 2024-07-17 12:49:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 621 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 74,716 KB
最終ジャッジ日時 2025-02-23 16:05:36
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <tuple>

using namespace std;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, x, y, z_l, z_r, z_c;
	cin >> N;
	vector<tuple<int, int, int>> ans;

	for (x = 0; x <= N; ++x)
		for (y = 0; y <= N && x * y <= N; ++y)
			if ((x != 0 || y != 0) && (N - x * y) % (x + y) == 0)
				ans.emplace_back(x, y, (N - x * y) / (x + y));

	cout << ans.size() << '\n';
	for (x = 0; x != ans.size(); ++x)
		cout << get<0>(ans[x]) << ' ' << get<1>(ans[x]) << ' ' << get<2>(ans[x]) << '\n';

	return 0;
}
0