3-1
First: output n for loop output three cups a[0],b[0],d[0] open to 50//or record output with a[]
Second: The premise: v1=e1+e2+e3 (according to this equation V1 known if E2 and E3 can meet E1 will be able to find out)!!!
The final state of the V3 can only be full or empty.
The final state of the V2 is either full or V3 multiples or empty (full itself is also a multiple of V3)//But when full, consider different methods.
The final state of the V1 is full or empty or!!!!!!! The wrong idea
The right thought: as long as the above situation V1 must be able to achieve the final state!!!!
The third E3 is 0 E2 0 0 times
E3 is 0 E2 is a multiple of V3 V1 to give V3 a V3 to give V2 multiples times + 1 times!!!!! Errors such as 5 3 2 and 2 3 0 only once
Correct: v2/v3 is not an integer when calculating multiples n1 from V1 to V3 to V2 to 2xn1 times
V2/v3 is an integer when calculating multiples n2= (v2-e2)/v3 from V1 to V2 to V3 to 2n2 +1 compared to 2n1
E3==v3 e2=0 1 times
E3=v3 E2 is a multiple of V3 V1 give V3 a V3 to V2 fold several times V1 again pour to V3 a multiplier + 2 times/Error
That's right
Misunderstanding: Both directions can be poured from the V3 to V2 can also be poured from the V2 to V3 things to the bidirectional nature
# include<stdio.h>
int main ()
{
int n,i,n1,n2,t,a[50]={0};
int v1,v2,v3,e1,e2,e3;
scanf ("%d", &n);
for (i=0;i<n;i++)
{
scanf ("%d%d%d", &v1,&v2,&v3);
scanf ("%d%d%d", &e1,&e2,&e3);
if (V1==E1+E2+E3)
{
if (e3==0 && e2==0)
{
a[i]=0;
}
else if (e3==v3 && e2==0)
{
A[i]=1;
}
else if (e3==0 && e2*1.0/v3 = = Int (e2*1.0/v3))
{
if (V2*1.0/v3==int (V2*1.0/V3))
{
N1= E2/v3; N2= (V2-E2)/v3
if (N1>N2)
{t=n1;n1=n2;n2=t;}
A[I]=N1;
}
Else
{
A[i]=e2*1.0/v3 +1;
}
}
else if (E3 ==v3 && e2*1.0/v3 = = Int (e2*1.0/v3))
{
if (V2*1.0/v3==int (V2*1.0/V3))
{
N1= E2/v3; N2= (V2-E2)/v3
if (N1>N2)
{t=n1;n1=n2;n2=t;}
A[I]=N1;
}
Else
{
A[i]=e2*1.0/v3 +2;
}
}
Else
{
A[i]=-1;
}
}
Else
A[i]=-1;
}
for (i=0;i<n;i++)
{
printf ("%d\n", A[i]);
}
return 0;
}