for this problem([CSUB Problem - CodeChef ]i am continuously getting wrong answer,
here is the code:-
#include<bits/stdc++.h>
using namespace std;
#define ll long int
int main()
{
ll t;
cin>>t;
while(t–)
{
ll n;
cin>>n;
string s;
cin>>s;
ll i;
ll count=0;
for(i=0;i<n;i++)
{
if(s[i] ==‘1’)
{
count++;
}
}
int p=count*(count+1)/2;
cout<<p<<endl;
}
return 0;
}
thanks in advance