In this HackerEarth Killjee and superdromes (Lowe) problem solution Killjee has recently read about superdromes. Superdromes are those numbers that are palindromic in both binary and decimal representation.

The number represented in binary representation will be up to its most significant bit which is 1. For example, 2 will be represented as {10}, 6 will be represented as {110} and so on. Now killjee ask you to find the number of Superdromes less than or equal to n for given n.

## HackerEarth Killjee and superdromes (Lowe) problem solution.

```#include<bits/stdc++.h>
using namespace std;
int ar={0};
int arcount=0;
int solve (int n)
{

if(arcount<n)

{

int total=ar[arcount];

for(int i=arcount+1;i<=n;i=i+2)

{

int temp=i;
int super=1;
int decimal;
int count=-1;
while(temp>0)

{

count++;

decimal[count]=temp%10;

temp=temp/10;

}

for(int j=0;j<=count/2;j++)

{

if(decimal[j]!=decimal[count-j])

{

super=0;

break;

}

}

if(super)

{

int binary;

temp = i;

count=-1;

while(temp>0)

{

count++;

binary[count]=temp%2;

temp=temp/2;

}

for(int j=0;j<=count/2;j++)

{

if(binary[j]!=binary[count-j])

{

super=0;

break;

}
}
}

if(super)
{

total++;
}

arcount++;

ar[arcount]=total;

arcount++;

ar[arcount]=total;

}

}

else

{

return ar[n];

}
}
int main()

{

int T;

cin >> T;

for(int t_i=0; t_i<T; t_i++)

{

int n;

cin >> n;

int out_;

out_ = solve(n);

cout << out_;

cout << "\n";

}

}```