Submission
Status:
[PPP-SSSSSSSSSS]
Score: 0
User: Dormon
Problemset: anna
Language: cpp
Time: 0.002 second
Submitted On: 2025-04-12 12:50:08
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void solve(){
vector<int> v(5, 0);
for (auto &e:v)
cin >> e;
sort(v.begin(), v.end());
do {
if (v[0] + v[1] % 2 == 1) continue;
int ta = (v[0] + v[1]) / 2, tb = (v[0] - v[1]) / 2;
if (tb == 0) continue;
if (ta * tb == v[2] && ta % tb == v[3] && ta / tb == v[4]){
cout << ta << ' ' << tb << '\n';
return ;
}
} while (next_permutation(v.begin(), v.end()));
cout << "0 0\n";
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int q;
cin >> q;
while (q--){
solve();
}
}