HDU 4931 Happy three Friends (water)

Source: Internet
Author: User

HDU 4931 Happy Three Friends

Topic links

Test instructions: 6 numbers, one take two, sister take three, ask who will win in the end

Idea: Order, judge the first two and 3-5 and who is bigger can

Code:

#include <cstdio> #include <cstring> #include <cmath> #include <algorithm>using namespace std; int T, A[6];int Main () {    scanf ("%d", &t);    while (t--) {for (int i = 0; i < 6; i++)    scanf ("%d", &a[i]), sort (A, a + 6); int aa = a[5] + a[4];int BB = a[3] + A[2] + a[1];if (aa > bb) printf ("Grandpa Shawn is the winner!\n"), Else printf ("What a sad story!\n");    }    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.