結果
| 問題 |
No.2358 xy+yz+zx=N
|
| コンテスト | |
| ユーザー |
遭難者
|
| 提出日時 | 2023-06-06 21:10:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,030 bytes |
| コンパイル時間 | 2,018 ms |
| コンパイル使用メモリ | 200,140 KB |
| 最終ジャッジ日時 | 2025-02-13 23:04:27 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) a.begin(), a.end()
void solve()
{
int n;
cin >> n;
int nn = n / 3;
vector<tuple<int, int, int>> ans;
int x = 0, xx = 0;
while (xx <= nn)
{
const int k = n + xx;
int yy = x << 1, yyy = yy * yy;
while (yyy <= k)
{
if (yy == 0 || k % yy > 0)
{
yyy += (yy++ << 1) | 1;
continue;
}
vector<int> per = {x, yy - x, k / yy - x};
do
{
ans.push_back({per[0], per[1], per[2]});
} while (next_permutation(ALL(per)));
yyy += (yy++ << 1) | 1;
}
xx += (x++ << 1) | 1;
}
cout << ans.size() << '\n';
for (auto &[x, y, z] : ans)
cout << x << ' ' << y << ' ' << z << '\n';
cout << "^_^" << '\n';
return;
}
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(13);
solve();
return 0;
}
遭難者