| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 5 초 | 2048 MB | 3 | 3 | 3 | 100.000% |
Busy Beaver recently learned about the Collatz Conjecture! He has written down a sequence of $N$ positive integers $a_1, a_2, \ldots , a_N$ on a blackboard to experiment with and further his understanding of the conjecture. He also notices a counter left on a table and comes up with the following game to play.
The counter initially starts at the number 1ドル$. A move consists of picking a number on the blackboard and replacing it:
After each replacement, Busy Beaver increments the counter by 1ドル$. If he cannot make any move, the game ends, and his score is the number of moves he performed (equivalently, one less than the number on the counter).
Busy Beaver wants to play this game for as long as possible. Help him determine the maximum number of moves he can perform before he runs out of moves!
The first line contains the number of test cases $T$ (1ドル \le T \le 500$).
The first line of each test case contains a single integer $N$ (1ドル \le N \le 500$), the number of positive integers on the blackboard.
The second line of each test case contains $N$ positive integers $a_1, a_2, \ldots , a_N$ (1ドル \le a_i \le 10^6$). It can be shown that any Collatz sequence started on a number at most 10ドル^6$ will reach 1ドル$ after at most 524ドル$ moves. Additionally, it can also be shown that Busy Beaver will eventually run out of moves and that he never writes a number larger than 10ドル^{18}$ on the blackboard.
The sum of $N$ across all test cases does not exceed 500ドル$.
For each test case, output a single integer --- the maximum number of moves that Busy Beaver can perform.
6 1 3 5 2 4 6 8 10 6 4 5 6 6 5 4 26 837799 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 3 1 4 1 5 9 2 6 5 10 123456 678910 111213 141516 171819 202122 232425 262728 293031 323334
4 0 14 164 34 60
In the first test case, Busy Beaver only has one number on the blackboard which is the number 3ドル$.
At this point, Busy Beaver cannot make any moves, so the maximum number of moves is 4ドル$.
In the second test case, Busy Beaver cannot make any move since there are no odd numbers on the blackboard.