help with c++...please paste indented code here Q1: A, B, C are three positive numbers (A<=B<=C). Given a list of seven
Posted: Sun May 15, 2022 12:38 pm
help with c++...please paste indented code here
Q1: A, B, C are three positive numbers (A<=B<=C). Given a
list of seven numbers which are made of A, B, C, A+B, B+C, A+C, and
A+B+C. Please find A, B and C use given seven numbers.
Sample input: 2 2 11 4 9 7 9
Sample output: 227
You could use additional test case to test your program:
Input: 41 19 22 38 22 19 3 Output: 3 19 19
Input: 148385247 819365820 793320372 26045448 122339799
670980573 697026021 Output: 26045448 122339799 670980573
Input: 326552445 762589144 699462434 63126710 436036699
372909989 389679155 Output: 63126710 326552445 372909989
Q2: There are three buckets size X, Y, M (1<=X<=Y<=M).
All three buckets are initially empty. Using these three buckets,
we can perform any number of the following two types of
operations.
We can fill the smallest bucket (of size X) completely to the
top with X units of water and pour it into the size-M bucket,
as long as this will not cause the size-M bucket to
overflow.
We can fill the medium bucket (of size Y) completely to the top
with Y units of water and pour it into the size-M bucket, as
long as this will not cause the size-M bucket to
overflow.
Although we may not be able to completely fill the size-M
bucket, but we can still determine the maximum amount of milk we
can possibly add to largest bucket.
Sample input: 17 25 77
Sample output: 76
In this example, we fill the bucket of size 17 three times and
then bucket of size 25 once, accumulating a total of 76 units of
water.
You could use additional test case to test your program:
Input: 52 791 877
Output: 843
Input: 26 783 882
Output: 861
Input: 18 46 894
Output: 894
Q3: Ask user enter size of array N, then ask user enter maximum
number of array element X, then create an array size N, and assign
each element of array to random number between 1~X. Print the
array, and also find which element appeared most in the array,
print all if there are multiple elements which are most at the same
time.
Sample input:
Enter N: 20 Enter X: 10
Sample output:
Q1: A, B, C are three positive numbers (A<=B<=C). Given a
list of seven numbers which are made of A, B, C, A+B, B+C, A+C, and
A+B+C. Please find A, B and C use given seven numbers.
Sample input: 2 2 11 4 9 7 9
Sample output: 227
You could use additional test case to test your program:
Input: 41 19 22 38 22 19 3 Output: 3 19 19
Input: 148385247 819365820 793320372 26045448 122339799
670980573 697026021 Output: 26045448 122339799 670980573
Input: 326552445 762589144 699462434 63126710 436036699
372909989 389679155 Output: 63126710 326552445 372909989
Q2: There are three buckets size X, Y, M (1<=X<=Y<=M).
All three buckets are initially empty. Using these three buckets,
we can perform any number of the following two types of
operations.
We can fill the smallest bucket (of size X) completely to the
top with X units of water and pour it into the size-M bucket,
as long as this will not cause the size-M bucket to
overflow.
We can fill the medium bucket (of size Y) completely to the top
with Y units of water and pour it into the size-M bucket, as
long as this will not cause the size-M bucket to
overflow.
Although we may not be able to completely fill the size-M
bucket, but we can still determine the maximum amount of milk we
can possibly add to largest bucket.
Sample input: 17 25 77
Sample output: 76
In this example, we fill the bucket of size 17 three times and
then bucket of size 25 once, accumulating a total of 76 units of
water.
You could use additional test case to test your program:
Input: 52 791 877
Output: 843
Input: 26 783 882
Output: 861
Input: 18 46 894
Output: 894
Q3: Ask user enter size of array N, then ask user enter maximum
number of array element X, then create an array size N, and assign
each element of array to random number between 1~X. Print the
array, and also find which element appeared most in the array,
print all if there are multiple elements which are most at the same
time.
Sample input:
Enter N: 20 Enter X: 10
Sample output: