Https://hack.codingblocks.com/contests/c/452/266

https://hack.codingblocks.com/contests/c/452/266
DIVISIBLE SUBARRAYS
one of the test case is failed…pls look into it

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.
:slight_smile:

code :https://hack.codingblocks.com/submission/667581

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.

code(coding blocks ide) : https://ide.codingblocks.com/#/s/13489
sorry…for the earlier links :stuck_out_tongue:

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 .

1 Like

okay…thanks
I will fix it