-->
当前位置:首页 > 题库

PROGRAMMING:Magic string

Luz5年前 (2021-05-10)题库399
The definition of magic string is: it only contains 1 and 2, and the corresponding number of each part is exactly the same as the original string after it is disassembled according to continuous 1 and 2
For example: 1 22 11 2 1 22 1 22 11 2 11 22... The number of 1 and 2 corresponding to each part is
1 2 1 2 1 2 1 2 2 1 2 2... Is exactly the same as the original string
Now, given n, how many 1s are there in the first n bits of magic string
###Input format:
Enter a T in the first line to represent the number of data groups
Next on line T, enter n
1 <= N <= 100000
###Output format:
For each group of inputs, the number of 1 in the first n bits is output in a row.
###Input example:
```in
one
six
```
###Output example:
```out
three
```






answer:If there is no answer, please comment