Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- //write your code here
- int t;
- cin>>t;
- while(t–)
- {
- int n,d=0,g=1;
- cin>>n;
- int a[n];
- for(int i=0;i<n;i++)
- {
- cin>>a[i];
- }
- for(int i=0;i<n;i++)
- {
- for(int j=i+1;j<n;j++)
- {
- for(int k=j+1;k<n;k++)
- {
- int x=a[i]*a[i],y=a[j]*a[j],z=a[k]*a[k];
- if(x==y+z||y==x+z||z==x+y)
- {
- // cout<<x/a[i]<<" “<<y/a[j]<<” “<<z/a[k]<<” "<<endl;
- if(g–){
- cout<<“Yes”<<endl;
- d+=1;
- break;
- }
- }
- }
- }
- }
- if(d==0)
- {
- cout<<“No”<<endl;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment