-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchefarrp.cpp
More file actions
41 lines (40 loc) · 798 Bytes
/
Copy pathchefarrp.cpp
File metadata and controls
41 lines (40 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<bits/stdc++.h>
#include<iostream>
#include<string.h>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
long long int n;
cin>>n;
long long int a[n];
for(int i=0;i<n;++i)
{
cin>>a[i];
}
int equal_count=0;
for(int i=0;i<n;i++)
{
for(int j=i;j<n;j++)
{
long int product=1,sum=0;
for(int k=i;k<=j;k++)
{
product*=a[k];
sum+=a[k];
}
if(product==sum)
{
equal_count++;
}
}
}
cout<<equal_count<<endl;
}
return 0;
}