A Poisson's wine
1. There is a 12 pint bottle filled with wine and 8 pints and 5 pints of bottles, asking how to separate 6 pints of wine.
public class Poissonpointsofwine
{
static final int l=12; Large screen capacity
static final int m=8;
static final int s=5;
static int l=12; Large bottle Actual liquor
static int m=0;
static int s=0;
static void Lintom ()
{
if (l>m)
{
M=m;
}else
{
M=l;
}
L=l-m;
System.out.printf ("\nl->m:\t l=%d\tm=%d\ts=%d\t", l,m,s);
}
static void Mintos ()
{
int n=s;
if (m+s>s)
{
S=s;
m=m-(S-N);
}else
{
S=s;
m=0;
}
L=l-m;
System.out.printf ("\nm->s:\t l=%d\tm=%d\ts=%d\t", l,m,s);
}
static void Sintol ()
{
L=l+s;
Q=r;
System.out.printf ("\ns->l:\t l=%d\tm=%d\ts=%d\t", l,m,s);
}
public static void Main (string[] args)
{
while (L!=L/2)
{
if (m==0)
{
Lintom ();
}
if (s==s)
{
Sintol ();
}else if (m!=0)
{
Mintos ();
}
}
}
}
Java Interview Fun Program