Ye_Cha @ 2024-11-28 11:09:17
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
int a,b,c; cin >> a >> b >> c;
string s = "123456789";
do
{
if ((stoi(s.substr(0, 3)))*b == (stoi(s.substr(3, 3)))*a &&(stoi(s.substr(3, 3)))*c == (stoi(s.substr(6, 3)))*b && (stoi(s.substr(0, 3))) * c == (stoi(s.substr(6, 3))) * a)
{
vector<long long>x;
x.push_back(stoi(s.substr(0, 3)));
x.push_back(stoi(s.substr(3, 3)));
x.push_back(stoi(s.substr(6, 3)));
sort(x.begin(), x.end());
for (long long i : x)cout << i << ' ';
cout << endl;
}
} while (next_permutation(s.begin(), s.end()));
return 0;
}
by 立柱已选162534 @ 2024-11-28 11:28:28
@Ye_Cha没判无解