Java Interview Fun Program

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.