When I pulled out a curry stick, no grail could stand in front of me. The saber is a weapon of mass destruction owned by the Grail, and the saber is curious about the power of the curry stick in his hand, and he begins to observe the light particles that appear when the curry sticks are released. He believes that the strength of the curry rod and the number of light particles have a relationship. The number of light grains is a large integer
X, Shirong found that the value of the curry rod is exactly the Lowbit (x). That is, after converting X to 2, only the lowest digit of 1 and its subsequent 0 are retained, and the preceding content is removed, the 10 numbers represented, such as 6 (110) Lowbit 2 (10), 12 (1100) Lowbit 4 (100), The Lowbit of 20 (10100) is also 4 (100). There is no priest Lang how to use the computer, so the Lang would like to ask you to help calculate the strength of the curry stick, the power value may be very large, so you only need to output it in addition to the remainder of the 109+7.
String division, binary, counting the number of divisions made when the first remainder is 1
The code is as follows:
#include <iostream> #include <stdio.h> #include <string> using namespace std; int Chuyitwo (string
& num) {int jie=0;
int len = Num.size ();
int temp;
int Yushu;
if ((num[len-1]-' 0 ')% 2 = 0) {Yushu = 0;
}else{Yushu = 1;
for (int i=0;i<len;i++) {temp = num[i]-' 0 ';
temp = jie*10;
Jie = temp% 2;
temp = TEMP/2;
num[i]= temp + ' 0 ';
return Yushu;
int main () {int t;
String num;
int flag = 1;
scanf ("%d", &t);
for (int i=0;i<t;i++) {flag = 1;
cin>>num;
while (Chuyitwo (num) ==0) {flag *= 2;
Flag = flag% 1000000007;
printf ("%d\n", flag);
return 0; }