Kmes has written three integers a𝑎, b𝑏 and c𝑐 in order to remember that he has to give Noobish_Monk a×b×c𝑎×𝑏×𝑐 bananas.Noobish_Monk has found these integers and decided to do the following at most 55 times:pick one of these integers;increase it by 11.For example, if a=2𝑎=2, b=3𝑏=3 and c=4𝑐=4, then one can increase a𝑎 three times by one and increase b𝑏 two times. After that a=5𝑎=5, b=5𝑏=5, c=4𝑐=4. Then the total number of bananas will be 5×5×4=1005×5×4=100.What is the maximum value of a×b×c𝑎×𝑏×𝑐 Noobish_Monk can achieve with these operations?InputEach test contains multiple test cases. The first line of input contains a single integer t𝑡 (1≤t≤10001≤𝑡≤1000) — the number of test cases. The description of the test cases follows.The first and only line of each test case contains three integers a𝑎, b𝑏 and c𝑐 (1≤a,b,c≤101≤𝑎,𝑏,𝑐≤10) — Kmes's integers.OutputFor each test case, output a single integer — the maximum amount of bananas Noobish_Monk can get.ExampleinputCopy22 3 410 1 10outputCopy100600
Question
Kmes has written three integers a𝑎, b𝑏 and c𝑐 in order to remember that he has to give Noobish_Monk a×b×c𝑎×𝑏×𝑐 bananas.Noobish_Monk has found these integers and decided to do the following at most 55 times:pick one of these integers;increase it by 11.For example, if a=2𝑎=2, b=3𝑏=3 and c=4𝑐=4, then one can increase a𝑎 three times by one and increase b𝑏 two times. After that a=5𝑎=5, b=5𝑏=5, c=4𝑐=4. Then the total number of bananas will be 5×5×4=1005×5×4=100.What is the maximum value of a×b×c𝑎×𝑏×𝑐 Noobish_Monk can achieve with these operations?InputEach test contains multiple test cases. The first line of input contains a single integer t𝑡 (1≤t≤10001≤𝑡≤1000) — the number of test cases. The description of the test cases follows.The first and only line of each test case contains three integers a𝑎, b𝑏 and c𝑐 (1≤a,b,c≤101≤𝑎,𝑏,𝑐≤10) — Kmes's integers.OutputFor each test case, output a single integer — the maximum amount of bananas Noobish_Monk can get.ExampleinputCopy22 3 410 1 10outputCopy100600
Solution
The problem is asking to find the maximum product of three numbers after performing at most 5 operations. An operation is defined as incrementing one of the numbers by 1.
Here are the steps to solve this problem:
-
First, sort the three numbers in ascending order. This is because we want to increase the smallest numbers first to get the maximum product.
-
Then, perform the operations. If the number of operations is less than or equal to the difference between the second and first number, add all operations to the first number. If not, add the difference to the first number and distribute the remaining operations equally between the first and second numbers.
-
Finally, multiply the three numbers to get the maximum product.
For example, if the input is 2 3 4, sort them to get 2 3 4. The difference between 3 and 2 is 1, so add 1 operation to the first number to get 3 3 4. There are 4 operations left, so add 2 to the first and second numbers to get 5 5 4. The product is 554 = 100.
If the input is 10 1 10, sort them to get 1 10 10. The difference between 10 and 1 is 9, so add 5 operations to the first number to get 6 10 10. There are no operations left, so the product is 61010 = 600.
Similar Questions
Only Plusestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKmes has written three integers a𝑎, b𝑏 and c𝑐 in order to remember that he has to give Noobish_Monk a×b×c𝑎×𝑏×𝑐 bananas.Noobish_Monk has found these integers and decided to do the following at most 55 times:pick one of these integers;increase it by 11.For example, if a=2𝑎=2, b=3𝑏=3 and c=4𝑐=4, then one can increase a𝑎 three times by one and increase b𝑏 two times. After that a=5𝑎=5, b=5𝑏=5, c=4𝑐=4. Then the total number of bananas will be 5×5×4=1005×5×4=100.What is the maximum value of a×b×c𝑎×𝑏×𝑐 Noobish_Monk can achieve with these operations?InputEach test contains multiple test cases. The first line of input contains a single integer t𝑡 (1≤t≤10001≤𝑡≤1000) — the number of test cases. The description of the test cases follows.The first and only line of each test case contains three integers a𝑎, b𝑏 and c𝑐 (1≤a,b,c≤101≤𝑎,𝑏,𝑐≤10) — Kmes's integers.OutputFor each test case, output a single integer — the maximum amount of bananas Noobish_Monk can get.ExampleinputCopy22 3 410 1 10outputCopy100600
There are total n number of Monkeys sitting on the branches of a huge Tree. As travelers offer Bananas and Peanuts, the Monkeys jump down the Tree. If every Monkey can eat k Bananas and j Peanuts. If total m number of Bananas and p number of Peanuts are offered by travelers, calculate how many Monkeys remain on the Tree after some of them jumped down to eat. At a time one Monkeys gets down and finishes eating and go to the other side of the road. The Monkey who climbed down does not climb up again after eating until the other Monkeys finish eating.Monkey can either eat k Bananas or j Peanuts. If for last Monkey there are less than k Bananas left on the ground or less than j Peanuts left on the ground, only that Monkey can eat Bananas(<k) along with the Peanuts(<j).Write code to take inputs as n, m, p, k, j and return the number of Monkeys left on the Tree. Where, n= Total no of Monkeys k= Number of eatable Bananas by Single Monkey (Monkey that jumped down last may get less than k Bananas) j = Number of eatable Peanuts by single Monkey(Monkey that jumped down last may get less than j Peanuts) m = Total number of Bananas p = Total number of PeanutsRemember that the Monkeys always eat Bananas and Peanuts, so there is no possibility of k and j having a value zero
A person has 3000 bananas and a camel. The person wants to transport the maximum number of bananas to a destination which is 1000 KMs away, using only the camel as a mode of transportation. The camel cannot carry more than 1000 bananas at a time and eats a banana every km it travels. What is the maximum number of bananas that can be transferred to the destination using only camel (no other mode of transportation is allowed).
A vendor buys bananas at 7 for Rs.6 and sells at 6 for Rs.7. What will be the result?
Question No 65.By giving 2 bananas free with every 5 apples bought, a shopkeeper makes a profit of 25%. However, by giving 5 bananas free with every 2 apples bought, he suffers a loss of 25%. What is the maximum number of bananas he can give away with 8 apples and still make a profit?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.