結果
問題 |
No.2358 xy+yz+zx=N
|
ユーザー |
|
提出日時 | 2023-10-25 23:43:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 647 bytes |
コンパイル時間 | 1,610 ms |
コンパイル使用メモリ | 172,916 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 07:47:30 |
合計ジャッジ時間 | 3,382 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:25:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 25 | for(auto [x, y, z] : res){ | ^
ソースコード
#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; int ans = 0; vector<tuple<int,int,int>> res; rep(x, 0, 1000){ rep(y, 0, 1000){ if(x == 0 && y == 0) continue; int w = N - x*y; if(w % (x + y) != 0 || w < 0) continue; ans++; int z = w / (x + y); res.push_back({x,y,z}); } } cout << ans << endl; for(auto [x, y, z] : res){ cout << x << ' ' << y << ' ' << z << endl; } return 0; }