8547: Multiply 2 Divide 2

内存限制:512 MB 时间限制:8 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:2 通过:1

题目描述

Note:There is no dependency between this problem and problem Hack of Multiply 2 Divide 2.
Frank_DD has a sequence a of length n.
For each operation, he selects a number ai(1in) and changes it to 2ai.
Frank_DD wants to know the minimum number of operations to change the sequence a to a non-descending sequence.

输入格式

The first line of the input contains one integer TT ((1T5 )) --- the number of test cases. Then T test cases follow.
In each test case:
The first line contains a single integer n(1n105) --- the length of sequence a.
The second line contains nn integers a1,a2,,an (1ai105) --- the sequence a.

输出格式

For each test case, print a single integer in a single line --- the minimum number of operations to change the sequence aa to a non-descending sequence.

输入样例 复制

2
7
6 3 3 4 10 8 2
10
9 9 4 7 3 10 10 8 4 3

输出样例 复制

4
11