結果
問題 | No.2358 xy+yz+zx=N |
ユーザー | srjywrdnprkt |
提出日時 | 2023-06-29 19:05:26 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,152 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 2,096 ms |
コンパイル使用メモリ | 203,936 KB |
実行使用メモリ | 5,784 KB |
最終ジャッジ日時 | 2023-09-20 14:11:19 |
合計ジャッジ時間 | 8,781 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 5 ms
4,376 KB |
testcase_08 | AC | 1,152 ms
5,688 KB |
testcase_09 | AC | 1,151 ms
5,784 KB |
testcase_10 | AC | 1,145 ms
4,376 KB |
testcase_11 | AC | 1,146 ms
4,380 KB |
testcase_12 | AC | 879 ms
4,380 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ int N, ans=0; cin >> N; vector<vector<int>> v; for (int x=1; x<=N; x++){ for (int y=0; y<=N/x; y++){ if (N-x*y >= 0 && (N-x*y)%(x+y) == 0){ v.push_back({x, y, (N-x*y)/(x+y)}); } } } for (int y=1; y<=N; y++) if (N % y == 0) v.push_back({0, y, N/y}); cout << v.size() << '\n'; for (auto &x : v) cout << x[0] << " " << x[1] << " " << x[2] << '\n'; return 0; }