Micro and Binary Strings


Micro’s wife Mini gave him a bag having N strings of length N. All the strings are binary i.e. made up of 1’s and 0’s only. All the strings in the bag can be generated by a string S by simply performing right rotations N times. \n\nFor example if S is \”101\”, then the strings in the bag will be \”110\”, \”011\”, \”101\”. Now Mini wants to know the number of ways of selecting one string from the bag with an odd decimal equivalent. Micro got very confused by all this, so he asked for your help.\n\nInput:\n\nThe first line consist of an integer T denoting the number of test cases.\nFirst line of each test case consists of an integer denoting N.\nSecond line of each test case consists of a binary string denoting S.\n\nOuptut:\nPrint the answer for each test case in a new line.\n\nConstraints:\n1<=T<=100\n1<=N<=10^5.


#include <bits/stdc++.h>
using namespace std;
int main()
    int q,x;
    char a[100000];
        int count=0;
        for(int i=0;i<x;i++)
    return 0;
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro