結果
問題 | No.2358 xy+yz+zx=N |
ユーザー |
|
提出日時 | 2023-10-28 11:29:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 621 ms / 2,000 ms |
コード長 | 770 bytes |
コンパイル時間 | 1,607 ms |
コンパイル使用メモリ | 176,992 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 16:16:57 |
合計ジャッジ時間 | 5,179 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:27:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 27 | for(auto [x,y,z] : ans){ | ^
ソースコード
#include<bits/stdc++.h>using namespace std;using ll = long long;#define rep(i,m,n) for(int i=m; i<n; ++i)#define repl(i,m,n) for(ll i=m; i<n; ++i)int main(){int N;cin >> N;set<tuple<int,int,int>> ans;for(int x = 1; x <= N; ++x){for(int y = 1; y*x <= N; y++){int w = N - x*y;if(w < 0 || w % (x + y) != 0) continue;int z = w / (x + y);ans.insert({x, y, z});ans.insert({x, z, y});ans.insert({y, x, z});ans.insert({y, z, x});ans.insert({z, x, y});ans.insert({z, y, x});}}cout << ans.size() << endl;for(auto [x,y,z] : ans){cout << x << ' ' << y << ' ' << z << endl;}return 0;}