Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help thanks! 6. 5 persons (called as A, B, C, D, and E) go out fishing, and collect all the fishes in one basket.

image text in transcribed

Please help thanks!

6. 5 persons (called as A, B, C, D, and E) go out fishing, and collect all the fishes in one basket. In the second day, the person A first wakes up. He discards one fish, and the rest fishes are exactly divided into 5 groups. Then, A takes away one group of fishes, and leaves the rest 4 groups. Then, person B wakes up, and he takes the left 4 groups of fishes as all the fishes remain. Similarly, he discards one fish, and the rest finishes can still be exactly divided into 5 groups. Then, C, D and E all repeat the same process: (1) discard one fish from the current number of fishes he saw, (2) divide the rest fishes (after discarding one fish) exactly into 5 groups, and take away one group. Everytime after discarding one fish, the rest fishes can exactly be divided into 5 groups. What is the smallest number of fishes that meets the requirement? Write a C programs to find the result by using iteration. (1 mark) Write another C program to solve the above question by using recursion. (1 mark) What is the smallest number of fishes that meets the requirement, when the number of people is 3 and 4, respectively? Use your program to find out. (1 mark) Intuitively, to find the smallest number of the fishes, the number of fish that the last person sees should be minimized. For example, when the number of people is N, the last person should always see N+1 fishes. Please use a specific case to prove that such intuitive conclusion is not correct, and explain why. (1 mark) 6. 5 persons (called as A, B, C, D, and E) go out fishing, and collect all the fishes in one basket. In the second day, the person A first wakes up. He discards one fish, and the rest fishes are exactly divided into 5 groups. Then, A takes away one group of fishes, and leaves the rest 4 groups. Then, person B wakes up, and he takes the left 4 groups of fishes as all the fishes remain. Similarly, he discards one fish, and the rest finishes can still be exactly divided into 5 groups. Then, C, D and E all repeat the same process: (1) discard one fish from the current number of fishes he saw, (2) divide the rest fishes (after discarding one fish) exactly into 5 groups, and take away one group. Everytime after discarding one fish, the rest fishes can exactly be divided into 5 groups. What is the smallest number of fishes that meets the requirement? Write a C programs to find the result by using iteration. (1 mark) Write another C program to solve the above question by using recursion. (1 mark) What is the smallest number of fishes that meets the requirement, when the number of people is 3 and 4, respectively? Use your program to find out. (1 mark) Intuitively, to find the smallest number of the fishes, the number of fish that the last person sees should be minimized. For example, when the number of people is N, the last person should always see N+1 fishes. Please use a specific case to prove that such intuitive conclusion is not correct, and explain why. (1 mark)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

=+How can CVP analysis assist managers?

Answered: 1 week ago