UVa1587 Box, uva1587box

Source: Internet
Author: User

UVa1587 Box, uva1587box

# Include <iostream>
# Include <algorithm>
# Include <set>
Using namespace std;

Int main ()
{
Set <int> s; // three or more different values cannot appear in 12 numbers. Up to three values are allowed: length, width, and height.
Int face [6];
Int I = 0, w, h;
While (cin> w> h)
{
If (s. size () <= 3)
{
S. insert (w );
S. insert (h );
If (w> h)
Face [I] = (h <16) | w; // condition 1 <= w, h <= 10000
Else
Face [I] = (w <16) | h;
}

If (++ I = 6)
{
If (s. size () <= 3)
{
Sort (face, face + 6 );
For (I = 0; I <6; I + = 2)
{// Determine whether three equal faces exist
If (face [I]! = Face [I + 1])
Break;
}
If (I = 6)
Cout <"POSSIBLE" <endl;
Else
Cout <"IMPOSSIBLE" <endl;
}
Else
{
Cout <"IMPOSSIBLE" <endl;
}
I = 0;
S. clear ();
}
}

Return 0;
}

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.