Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5761 |

@blackshadows | 5715 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4944 |

@saiujwal13083 | 4506 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3516 |

@sushant_a | 3459 |

@verma_ji | 3341 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@aroranayan999 | 1115 |

@bt8816103042 | 739 |

@thealchemist627 | 456 |

@akashkale117 | 453 |

@shivanandp12345678910 | 453 |

@dalwainazism125 | 453 |

@codeantik | 448 |

@SherlockHolmes3 | 447 |

@SHOAIBVIJAPURE | 430 |

@shalinibhataniya1097 | 408 |

@neverevergiveup | 393 |

Complete Leaderboard |

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<=10^{5}

**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.

Login to report an issue on this page.

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

Yes
Even Decimal Binary String

...