Leaderboard
Showing:
Even Decimal Binary String
Easy Accuracy: 34.91% Submissions: 255 Points: 2

Given a binary string of size n. you have to count all substring that has even value in its decimal form.

Note: we convert binary String Into decimal from left to right ( 10010:- in Decimal: 9 ).

Input: The first line of input contains an integer T i.e number of the test case. each test case contains n (that is the size of binary string ) and a Binary string of size n.

output: For each test case, In new line print the total count of even binary string.

Constraints:

 1 <= T <= 1000

1<=n<=105

Example :

Input :

2

2

01

5

10010

output :

2

8

Explanation:

Test Case 1 :  substring  are :  0  , 01 , 1  in decimal form : 0 , 2 , 1 so total: 2 even decimal value.

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Even Decimal Binary String

Output Window