結果
| 問題 |
No.2358 xy+yz+zx=N
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2023-07-13 20:24:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 84 ms / 2,000 ms |
| コード長 | 876 bytes |
| コンパイル時間 | 1,684 ms |
| コンパイル使用メモリ | 200,296 KB |
| 最終ジャッジ日時 | 2025-02-15 10:15:15 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
set<pair<int,pair<int,int>>> ans;
for(int x=0; x*x<=N; x++){
for(int y=x; y*y<=N; y++){
if(x+y>0 && (N-x*y)%(x+y)==0){
int z=(N-x*y)/(x+y);
if(y<=z){
ans.insert(make_pair(x,make_pair(y,z)));
ans.insert(make_pair(x,make_pair(z,y)));
ans.insert(make_pair(y,make_pair(x,z)));
ans.insert(make_pair(y,make_pair(z,x)));
ans.insert(make_pair(z,make_pair(x,y)));
ans.insert(make_pair(z,make_pair(y,x)));
}
}
}
}
cout << ans.size() << endl;
for(auto _ans:ans){
cout << _ans.first << " " << _ans.second.first << " " << _ans.second.second << endl;
}
return 0;
}
nonon