-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblanket_NotOrg.cpp
More file actions
36 lines (34 loc) · 952 Bytes
/
blanket_NotOrg.cpp
File metadata and controls
36 lines (34 loc) · 952 Bytes
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
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int main(){
fast;
#ifndef ONLINE_JUDGE
freopen("inputf.in","r",stdin);
freopen("outputf.out","w",stdout);
#endif
//////////////////////////////////
int sc[3], bl[3],fold=0, stop=0,possible=0;
int T;
cin>>T;
while(T--){
possible=1;
fold=0,stop=0,possible=0;
for(int i=0; i<3; i++)cin>>sc[i];
sort(sc,sc+3);
for(int i=0; i<3; i++)cin>>bl[i];
sort(bl,bl+3);
if((bl[2]==sc[2] && bl[0]==sc[0] && bl[1]==sc[1]))cout<<0<<endl;
else{
while(bl[0]<sc[0]){
bl[0]*=2;
bl[2]/=2;
fold++;
if(bl[0]>sc[0]){possible=0;break;}
if(bl[2]==sc[2] || bl[0]==sc[0]){possible=1;break;}
}
possible?cout<<fold<<"\n":cout<<-1<<"\n";
}
}
return 0;}