結果
問題 | No.2358 xy+yz+zx=N |
ユーザー |
![]() |
提出日時 | 2023-06-23 21:26:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 822 ms / 2,000 ms |
コード長 | 542 bytes |
コンパイル時間 | 1,683 ms |
コンパイル使用メモリ | 171,592 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 17:25:32 |
合計ジャッジ時間 | 6,542 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int N;cin >> N;vector<tuple<int, int, int>> ans;for (int x = 0; x <= N; x++){for (int y = 0; x * y <= N && y <= N; y++){if (!(x + y == 0)){if ((N - x * y) % (x + y) == 0){int z = (N - x * y) / (x + y);ans.push_back(make_tuple(x, y, z));}}}}int T = ans.size();cout << T << endl;for (int i = 0; i < T; i++){cout << get<0>(ans[i]) << ' ' << get<1>(ans[i]) << ' ' << get<2>(ans[i]) << endl;}}