#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
int main()
{
ll n, m, i, j;
cin >> m;
while(m--)
{
cin >> n;
ll a[n];
for(i=0;i<n;i++)
{
cin >> a[i];
}
ll c = 0;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]+a[j] == a[i]*a[j])
c++;
}
}
cout << c << endl;
}
return 0;
}
#define ll unsigned long long int
using namespace std;
int main()
{
ll n, m, i, j;
cin >> m;
while(m--)
{
cin >> n;
ll a[n];
for(i=0;i<n;i++)
{
cin >> a[i];
}
ll c = 0;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]+a[j] == a[i]*a[j])
c++;
}
}
cout << c << endl;
}
return 0;
}
Comments
Post a Comment