National Software 2. Age of three

Source: Internet
Author: User

Three mysterious masked people visit Dr. F.
When the doctor asked them about their age, they said: the youngest of us is not more than 19 years old. The total age of the three is 70. The product of the age of the three of us is the largest in all possible cases.
Ask Dr. F to calculate their ages, which are arranged in ascending order and separated by commas.

Reference answer:
19,25, 26
My answer is 23 23 24.

# Include <iostream> using namespace STD; int main () {int x, y, z; int max = 0, Im = 0, JM = 0, Km = 0; for (INT I = 19; I <61; I ++) for (Int J = 19; j <61; j ++) for (int K = 19; k <61; k ++) {if (I + J + k = 70) {If (max <I * j * k) {max = I * j * K; im = I; JM = J; Km = K ;}} cout <im <"" <JM <"" <km <Endl; 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.