link of the code
#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;
}
i am unable to get you sir
1 Like
Thanks, but that has all the forum-mangling from the original post and won’t compile
#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;
}