Getting WA in CSUB

Getting wrong answer in the problem ( CSUB Problem - CodeChef ) . Can someone please tell me what I am doing wrong.

Here’s my code

#include
using namespace std;

int main() {
std::ios::sync_with_stdio(false);
int t;
cin>>t;
while(t–)
{
int n;;
cin>>n;
char s[n];
int No_of_1s=0;
for(int i=0;i<n;i++)
{
cin>>s[i];
if(s[i]==‘1’)
{
No_of_1s++;
}
}
long long int No_of_substrings=0;
if(No_of_1s==0)
{
No_of_substrings=0;;
}
else
{
No_of_substrings=No_of_1s+No_of_1s*(No_of_1s-1)/2;

    }
    cout<<No_of_substrings<<"\n";
}// your code goes here
return 0;

}

Firstly, please give the link to your code, and don’t copy paste the whole code here. It is much easier to see and compile, because the discuss forum mangles your code.

Secondly, you are getting a wrong answer because of overflow.
int data type holds integers from -2^{31} to 2^{31}-1, which is approximately from -2*10^9 to 2*10^9, but the answer can exceed 10^{10}. Thus changing int to long long should solve the problem.

Edit: Here is your AC code. Changed int to long long
https://www.codechef.com/viewsolution/38151181