Saleh127

UVA 11565

Dec 9th, 2020
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10.  
  11. test
  12.  
  13. {
  14.  
  15. ll x,y,z,i,j,k,l,a,b=0;
  16. cin>>x>>y>>z;
  17.  
  18. for(i=-100; i<=100; i++)
  19. {
  20. for(j=-100; j<=100; j++)
  21. {
  22. for(k=-100; k<=100; k++)
  23. {
  24. if((i+j+k)==x && (i*j*k)==y && (i*i+j*j+k*k)==z && i!=j && j!=k && i!=k)
  25. {
  26. cout<<i<<" "<<j<<" "<<k<<endl;
  27. b=1;
  28. goto aa;
  29. }
  30. }
  31. }
  32. }
  33. aa:
  34. if(b==0) cout<<"No solution."<<endl;
  35.  
  36. }
  37.  
  38.  
  39. return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment