-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDense-Array.cpp
51 lines (44 loc) · 860 Bytes
/
Dense-Array.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<bits/stdc++.h>
using namespace std;
int insert(int n){
for(int i=1; i<n ;i++){
int maxii=max(a[i],a[i+1]);
int minii=min(a[i],a[i+1]);
int count;
if( ! maxii/minii<=2){
cin >> a[i];
count++;
}
else(){
break;
}
}
}
int main()
{
int test;
cin>>test;
for(int i=0;i<test;i++)
{
int size;
cin>>size;
int a[size];
for(int i=0;i<size;i++)
{
cin>>a[i];
}
int counts=0;
for(int i=0;i<size-1;i++)
{
int maxii=max(a[i],a[i+1]);
int minii=min(a[i],a[i+1]);
while(!(maxii/minii)<2)
{
maxii=ceil(maxii/2);
counts++;
}
}
cout<<counts<<endl;
}
return 0;
}