Guest User

Untitled

a guest
Dec 12th, 2019
48
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. //write your code here
  7. int t;
  8. cin>>t;
  9. while(t–)
  10. {
  11. int n,d=0,g=1;
  12. cin>>n;
  13. int a[n];
  14. for(int i=0;i<n;i++)
  15. {
  16. cin>>a[i];
  17. }
  18. for(int i=0;i<n;i++)
  19. {
  20. for(int j=i+1;j<n;j++)
  21. {
  22. for(int k=j+1;k<n;k++)
  23. {
  24. int x=a[i]*a[i],y=a[j]*a[j],z=a[k]*a[k];
  25. if(x==y+z||y==x+z||z==x+y)
  26. {
  27. // cout<<x/a[i]<<" “<<y/a[j]<<” “<<z/a[k]<<” "<<endl;
  28. if(g–){
  29. cout<<“Yes”<<endl;
  30. d+=1;
  31. break;
  32. }
  33. }
  34. }
  35. }
  36. }
  37. if(d==0)
  38. {
  39. cout<<“No”<<endl;
  40. }
  41. }
  42. return 0;
  43. }
RAW Paste Data