結果

問題 No.2358 xy+yz+zx=N
ユーザー srjywrdnprkt
提出日時 2023-06-29 19:05:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,159 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 198,264 KB
最終ジャッジ日時 2025-02-15 03:08:19
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0