Submission
Status:
[PPPP-SSSSSSSSS]
Score: 0
User: MiyaZaki1072
Problemset: anna
Language: cpp
Time: 0.002 second
Submitted On: 2025-04-12 20:11:29
#include <bits/stdc++.h>
using namespace std;
#define int long long
int p[6];
signed main(){
cin.tie(0)->sync_with_stdio(0);
int tc;cin>>tc;
while(tc--){
int aa=0,bb=0,ch=0;
for(int i=1;i<=5;i++)cin>>p[i];
sort(p+1,p+6);
do{
int a = (p[1]+p[2])/2;
int b = sqrt((p[3]*p[4]));
if(b==0)continue;
if(a+b == p[1] && a-b == p[2] && a*b == p[3] && a%b == p[4] && a/b == p[5]){
aa = max(a,b);
bb = min(a,b);
ch++;
}
}while(next_permutation(p+1,p+6));
if(ch==0 || ch > 1)cout<<"0 0\n";
else cout<<aa<<" "<<bb<<"\n";
}
}