#include<stdio.h>
int main(void)
{
long long int t,i,j,pair;
scanf("%lld",&t);
long long int n;
while(t--)
{
pair=0;
scanf("%lld",&n);
long long int a[n];
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
for(i=0;i<=(n/2);i++)
{
for(j=i+1;j<n;j++)
{
if((a[i]+a[j])==(a[i]*a[j]))
pair++;
}
}
printf("%lld \n",pair);
}
return 0;
}```
can u explain how to format it
now tell me the error
Question link
Which RE ?
It’s TLE not RE.
If it’s this, which it seems to be, it’s a TLE, not an RE.
Edit:
Beaten XD
Edit2:
Maybe I should not include the whole “Format your Code” thing from now on, and just tell people to link to their solutions instead.
i m not sure
can you initialize i,j,pair inside while of t.
I think he should get TLE and not RE ?
Maybe
@raghav_3018 I am very noob in C++. I generally use python. I think @ssjgz and @everule1 can help you. They are pro in C++ and super helpful.
Edit: they already help
The test cases are weak I think
try:
1
6
1 3 2 4 0 0
sorry guys and thnx for the help
and u r right ssjgz and shlok and everule
I beat you because this was a question from december challenge which i had given
I didn’t check the submission link
if((a[i]+a[j])==(a[i]*a[j]))
pair++;
This gave it away, and the code was O(n^2)