Knowee
Questions
Features
Study Tools

Athletes of Chefland have won 𝐺G gold medals, 𝑆S silver medals, and 𝐵B bronze medals in the Paris Olympics.Chef will be happy only if the Chefland team wins 55 medals of each type. Find the total number of additional medals the team needs to win to make Chef happy.Input FormatThe first and only line of input will contain three space-separated integers 𝐺,𝑆,G,S, and 𝐵B — the number of gold, silver, and bronze medals, respectively.Output FormatFor each test case, output on a new line, the total number of additional medals the team needs to win to make Chef happy.Constraints1≤𝐺,𝑆,𝐵≤51≤G,S,B≤5Sample 1:InputOutput5 1 45Explanation:The team already has 55 gold medals. They need 44 silver medals and 11 bronze medal. Thus, a total of 55 medals are needed to make Chef happy.Sample 2:InputOutput2 1 111Explanation:The team needs 33 gold, 44 silver, and 44 bronze medals. Thus, they need a total of 1111 medals to make Chef happy.

Question

Athletes of Chefland have won 𝐺G gold medals, 𝑆S silver medals, and 𝐵B bronze medals in the Paris Olympics.Chef will be happy only if the Chefland team wins 55 medals of each type. Find the total number of additional medals the team needs to win to make Chef happy.Input FormatThe first and only line of input will contain three space-separated integers 𝐺,𝑆,G,S, and 𝐵B — the number of gold, silver, and bronze medals, respectively.Output FormatFor each test case, output on a new line, the total number of additional medals the team needs to win to make Chef happy.Constraints1≤𝐺,𝑆,𝐵≤51≤G,S,B≤5Sample 1:InputOutput5 1 45Explanation:The team already has 55 gold medals. They need 44 silver medals and 11 bronze medal. Thus, a total of 55 medals are needed to make Chef happy.Sample 2:InputOutput2 1 111Explanation:The team needs 33 gold, 44 silver, and 44 bronze medals. Thus, they need a total of 1111 medals to make Chef happy.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

To solve this problem, you need to subtract the number of medals the team already has from the number Chef wants them to have, which is 5 for each type of medal.

Here are the steps to solve this problem:

  1. Subtract the number of gold medals the team already has from 5. This will give you the number of additional gold medals the team needs to win.
  2. Subtract the number of silver medals the team already has from 5. This will give you the number of additional silver medals the team needs to win.
  3. Subtract the number of bronze medals the team already has from 5. This will give you the number of additional bronze medals the team needs to win.
  4. Add up the additional gold, silver, and bronze medals to get the total number of additional medals the team needs to win.

For example, if the team has 2 gold, 1 silver, and 1 bronze medal, they need to win 3 more gold, 4 more silver, and 4 more bronze medals. So, the total number of additional medals they need to win is 3 + 4 + 4 = 11.

This problem has been solved

Similar Questions

Chef organised a 3030 kilometres marathon in Chefland.The participants receive medals on completing the marathon as following:If the total time taken is less than 33 hours, they receive a GOLD medal.If the total time taken is greater than equal to 33 hours but less than 66 hours, they receive a SILVER medal.If the total time taken is greater than equal to 66 hours, they receive a BRONZE medal.Chefina participated in the marathon and completed it in 𝑋X hours. Which medal would she receive?Input FormatThe input consists of a single integer 𝑋X — the number of hours Chefina took to complete the marathon.Output FormatOutput the medal Chefina would recieve.Note that you may print each character in uppercase or lowercase. For example, the strings GOLD, gold, Gold, and gOlD are considered the same.Constraints1≤𝑋≤101≤X≤10.Sample 1:InputOutput2GOLDExplanation:Chefina completed the marathon in less than 33 hours. Thus, she gets a GOLD medal.Sample 2:InputOutput5SILVERExplanation:Chefina took more than 33 but less than 66 hours. Thus, she gets a SILVER medal.Sample 3:InputOutput6BRONZEExplanation:Chefina took 66 hours to complete the marathon. Thus, she gets a BRONZE medal.

In Chefland, a football player gets 22 points for each goal and 11 point for each assist.Messi has 𝐴A goals and 𝐵B assists this season, whereas Ronaldo has 𝑋X goals and 𝑌Y assists.Find out the player with more points this season.Input FormatThe first and only line of input will contains four space-separated integers 𝐴A, 𝐵B, 𝑋X and 𝑌Y, the number of goals and assists that Messi has and the number of goals and assists that Ronaldo has, respectively.Output FormatPrint a single line containing:Messi, if Messi has more points than Ronaldo.Ronaldo, if Ronaldo has more points than Messi.Equal, if both have equal points.You can print each character in uppercase or lowercase. For example, the strings Messi, MESSI, messi, and MeSSi are considered identical.Constraints0≤𝐴,𝐵,𝑋,𝑌≤1000≤A,B,X,Y≤100Sample 1:InputOutput40 30 50 10EqualExplanation:Messi has 4040 goals and 3030 assists. Thus, his total points are 40⋅2+30=11040⋅2+30=110.Ronaldo has 5050 goals and 1010 assists. Thus, his total points are 50⋅2+10=11050⋅2+10=110.Both have 110110 points.Sample 2:InputOutput91 22 60 30 MessiExplanation:Messi has 9191 goals and 2222 assists. Thus, his total points are 91⋅2+22=20491⋅2+22=204.Ronaldo has 6060 goals and 3030 assists. Thus, his total points are 60⋅2+30=15060⋅2+30=150.Messi has 204204 points, whereas Ronaldo has 150150.Sample 3:InputOutput60 30 80 20RonaldoExplanation:Messi has 6060 goals and 3030 assists. Thus, his total points are 60⋅2+30=15060⋅2+30=150.Ronaldo has 8080 goals and 2020 assists. Thus, his total points are 80⋅2+20=18080⋅2+20=180.Messi has 150150 points, whereas Ronaldo has 180180.

Chef is playing a mobile game. In the game, Chef's character Chefario can perform special attacks. However, one special attack costs 𝑋X mana points to Chefario.If Chefario currently has 𝑌Y mana points, determine the maximum number of special attacks he can perform.Input FormatThe first line contains a single integer 𝑇T — the number of test cases. Then the test cases follow.The first and only line of each test case contains two space-separated integers 𝑋X and 𝑌Y — the cost of one special attack and the number of mana points Chefario has initially.Output FormatFor each test case, output the maximum number of special attacks Chefario can perform.Constraints1≤𝑇≤1051≤T≤10 5 1≤𝑋≤1001≤X≤1001≤𝑌≤10001≤Y≤1000Sample 1:InputOutput310 306 4150 2360Explanation:Test case 11: Chefario can perform a maximum of 33 special attacks which will cost him 3030 mana points.Test case 22: Chefario can perform a maximum of 66 special attacks which will cost him 3636 mana points. Note that Chefario can not perform 77 special attacks as these will cost him 4242 mana points while he has only 4141 mana points.Test case 33: Chefario will not be able to perform any special attacks in this case.

Chef and some of his friends are planning to participate in a puzzle hunt event.The rules of the puzzle hunt state:"This hunt is intended for teams of 66 to 88 people."Chef's team has 𝑁N people in total. Are they eligible to participate?Input FormatThe first and only line of input will contain a single integer 𝑁N: the number of people present in Chef's team.Output FormatPrint the answer: Yes if Chef's team is eligible to participate, and No otherwise.Each letter in the output may be printed in either uppercase or lowercase, i.e, the outputs NO, No, nO, no will all be treated as equivalent.Constraints1≤𝑁≤101≤N≤10Sample 1:InputOutput4NoExplanation:The puzzle hunt requires between 66 and 88 people in a team.44 isn't between 66 and 88, so Chef's team cannot participate.Sample 2:InputOutput7YesExplanation:Chef's team has 77 people, and 77 lies between 66 and 88.So, Chef's team can participate in the event.Sample 3:InputOutput8YesExplanation:Chef's team has 88 people, and 88 lies between 66 and 88.So, Chef's team can participate in the event.

There are 𝑁N students including Chef in a school. The school bus has 𝑀M seats, and every student in the school travels on the bus.It is guaranteed that 𝑁≤𝑀N≤M, so that everyone will have a seat.Chef is happy when the school bus is not full.Given 𝑁N and 𝑀M, your task is to find out whether Chef will be happy.Input FormatThe only line of input will contain two space-separated integers 𝑁N and 𝑀M, denoting the number of students in the school and the number of seats in the school bus respectively.Output FormatFor each test case, output on a new line the answer: YES, if Chef will be happy, and NO otherwise.You may print each character of the string in uppercase or lowercase (for example, the strings YeS, yEs, yes, and YES will all be treated as identical).Constraints1≤𝑁≤𝑀≤101≤N≤M≤10Sample 1:InputOutput2 3YESExplanation:There are 22 students and 33 seats on the bus.So, there will be one empty seat on the bus and Chef will be happy.Sample 2:InputOutput6 6NOExplanation:There are 66 students and 66 seats on the bus.The bus will be full and Chef will not be happy.

1/3

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.