Hdu 3816 To Be number one number theory is the main idea

Source: Internet
Author: User

To Be NUMBER ONE
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission (s): 383 Accepted Submission (s): 190
Special Judge

Problem Description
One is an interesting integer. This is also an interesting problem. You are assigned with a simple task.
Find N (3 <= N <= 18) different positive integers Ai (1 <= I <= N), and

 

Any possible answer will be accepted.
 

Input
No input file.
 

Output
Your program's output shoshould contain 16 lines:
The first line contain 3 integers which are the answer for N = 3, separated by a single blank.
The following 15 lines are the answer for N = 4 to 18, as the same format.
The sample output is the first two lines of a possible output.
 

Sample Output
2 3 6
2 4 6 12
 
Question
The reciprocal sum of numbers 3 to 18 is equal to 1.
And each number must be less than or equal to the number + 1 square
For example, three numbers are used.
The three numbers must meet the condition that these three numbers are less than or equal to (3 + 1) * (3 + 1) and the reciprocal sum is 1.
 
Ideas:
A reciprocal can be divided into the reciprocal sum of two numbers.
1/n = 1/(a * B) = 1/a * (a + B) + 1/B * (a + B)
 
Therefore, when the upper layer is known, the number of the upper layer can be directly divided into two, and so on.
 
I did not write a program
[Cpp]
# Include <stdio. h>
Int main ()
{

Printf ("2 3 6 \ n ");
Printf ("2 4 6 12 \ n ");
Printf ("2 5 6 12 20 \ n ");
Printf ("2 5 7 12 20 42 \ n ");
Printf ("3 5 6 7 12 20 42 \ n ");
Printf ("3 5 6 8 12 20 42 56 \ n ");
Printf ("3 5 6 8 16 20 42 48 56 \ n ");
Printf ("3 5 6 12 16 20 24 42 48 56 \ n ");
Printf ("3 5 6 16 20 21 24 28 42 48 56 \ n ");
Printf ("3 5 6 16 21 24 28 36 42 45 48 56 \ n ");
Printf ("3 5 6 16 24 28 30 36 42 45 48 56 70 \ n ");
Printf ("3 5 6 16 28 30 33 36 42 45 48 56 70 88 \ n ");
Printf ("3 5 6 16 28 33 36 39 42 45 48 56 70 88 130 \ n ");
Printf ("3 5 6 16 33 36 39 42 45 48 56 70 77 88 130 \ n ");
Printf ("3 5 6 20 33 36 39 42 45 48 56 70 77 80 88 130 \ n ");
Printf ("3 5 6 24 33 36 39 42 45 48 56 70 77 80 88 120 130 \ 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.