結果

問題 No.2358 xy+yz+zx=N
ユーザー SSRSSSRS
提出日時 2023-06-23 21:26:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 824 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 170,632 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 10:01:39
合計ジャッジ時間 6,459 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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