結果

問題 No.2358 xy+yz+zx=N
ユーザー tsugutsugutsugutsugu
提出日時 2023-06-23 21:51:31
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 812 bytes
コンパイル時間 2,749 ms
コンパイル使用メモリ 247,660 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 10:05:37
合計ジャッジ時間 4,802 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,376 KB
testcase_01 AC 11 ms
4,376 KB
testcase_02 AC 11 ms
4,376 KB
testcase_03 AC 11 ms
4,380 KB
testcase_04 AC 11 ms
4,376 KB
testcase_05 AC 12 ms
4,376 KB
testcase_06 AC 12 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 1
#endif

const int MX = 3300;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<tuple<int, int, int>> ans;
    for (int x = 0; x <= MX; x++) {
        for (int y = 0; y <= MX; y++) {
            if (x == 0 && y == 0) {
                continue;
            }
            if (n - x * y < 0) {
                continue;
            }
            if ((n - x * y) % (x + y) == 0) {
                ans.emplace_back(x, y, (n - x * y) / (x + y));
            }
        }
    }
    cout << ans.size() << '\n';
    for (int i = 0; i < (int) ans.size(); i++) {
        cout << get<0>(ans[i]) << ' ' << get<1>(ans[i]) << ' ' << get<2>(ans[i]) << '\n';
    }
}
0