https://hack.codingblocks.com/contests/c/452/266
DIVISIBLE SUBARRAYS
one of the test case is failed…pls look into it
Https://hack.codingblocks.com/contests/c/452/266
Provide ur code also.
#include
#include
using namespace std;
int main()
{
int t;
cin>>t;
if(t>=1 && t<=10)
{
while(t–)
{
int n,ans=0;
char *c = new char[1000000000];
//long long a[100000];
cin>>n;
if(n>=1 && n<=100000)
{
int sum[100000]={0},j=1;
for(int i=0;i<n;i++)
{
cin>>c[i];
sum[j]=(((sum[j-1])+(c[i]-‘0’))%n);
j++;
}
for(int i=0;i<=n;i++)
{
if(sum[i]==0)
{
ans+=1;
}
}
cout<<((ans*(ans-1))/2)<<endl;
}
}
}
return 0;
}
Hey Pooja ! there are many errors in ur code which should be removed first. Like you have written wrong condition inside while loop and there are no header file and many others. Then provide ide link of ur code.
That’s wrong , that’s ur submission code which i cant see. copy ur code into ide.codingblocks.com and save it then provide its link.
Your code is giving wrong ouput for this case – >>
2
5
1 0 0 0 -1
5
5 5 5 5 5
So, try to fix this .
okay…thanks
I will fix it