Knowee
Questions
Features
Study Tools

In a coding contest, there are prizes for the top rankers. The prize scheme is as follows:Top 1010 participants receive rupees 𝑋X each.Participants with rank 1111 to 100100 (both inclusive) receive rupees 𝑌Y each.Find the total prize money over all the contestants.Input FormatFirst line will contain 𝑇T, number of test cases. Then the test cases follow.Each test case contains of a single line of input, two integers 𝑋X and 𝑌Y - the prize for top 1010 rankers and the prize for ranks 1111 to 100100 respectively.Output FormatFor each test case, output the total prize money over all the contestants.Constraints1≤𝑇≤10001≤T≤10001≤𝑌≤𝑋≤10001≤Y≤X≤1000Sample 1:InputOutput41000 1001000 100080 1400 30190001000008906700Explanation:Test Case 11: Top 1010 participants receive rupees 10001000 and next 9090 participants receive rupees 100100 each. So, total prize money =10⋅1000+90⋅100=19000=10⋅1000+90⋅100=19000.Test Case 22: Top 1010 participants receive rupees 10001000 and next 9090 participants receive rupees 10001000 each. So, total prize money =10⋅1000+90⋅1000=100000=10⋅1000+90⋅1000=100000.Test Case 33: Top 1010 participants receive rupees 8080 and next 9090 participants receive rupee 11 each. So, total prize money =10⋅80+90⋅1=890=10⋅80+90⋅1=890.Test Case 44: Top 1010 participants receive rupees 400400 and next 9090 participants receive rupees 3030 each. So, total prize money =10⋅400+90⋅30=6700=10⋅400+90⋅30=6700.

Question

In a coding contest, there are prizes for the top rankers. The prize scheme is as follows:Top 1010 participants receive rupees 𝑋X each.Participants with rank 1111 to 100100 (both inclusive) receive rupees 𝑌Y each.Find the total prize money over all the contestants.Input FormatFirst line will contain 𝑇T, number of test cases. Then the test cases follow.Each test case contains of a single line of input, two integers 𝑋X and 𝑌Y - the prize for top 1010 rankers and the prize for ranks 1111 to 100100 respectively.Output FormatFor each test case, output the total prize money over all the contestants.Constraints1≤𝑇≤10001≤T≤10001≤𝑌≤𝑋≤10001≤Y≤X≤1000Sample 1:InputOutput41000 1001000 100080 1400 30190001000008906700Explanation:Test Case 11: Top 1010 participants receive rupees 10001000 and next 9090 participants receive rupees 100100 each. So, total prize money =10⋅1000+90⋅100=19000=10⋅1000+90⋅100=19000.Test Case 22: Top 1010 participants receive rupees 10001000 and next 9090 participants receive rupees 10001000 each. So, total prize money =10⋅1000+90⋅1000=100000=10⋅1000+90⋅1000=100000.Test Case 33: Top 1010 participants receive rupees 8080 and next 9090 participants receive rupee 11 each. So, total prize money =10⋅80+90⋅1=890=10⋅80+90⋅1=890.Test Case 44: Top 1010 participants receive rupees 400400 and next 9090 participants receive rupees 3030 each. So, total prize money =10⋅400+90⋅30=6700=10⋅400+90⋅30=6700.

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

Solution

The problem is asking to calculate the total prize money for a coding contest. The prize distribution is as follows:

  • The top 10 participants receive a certain amount (X) each.
  • Participants ranked from 11 to 100 receive a different amount (Y) each.

The input will be the number of test cases (T), and for each test case, two integers X and Y representing the prize money for the top 10 and the participants ranked from 11 to 100 respectively.

The output should be the total prize money for all the contestants for each test case.

The constraints are that T, X, and Y are all integers and 1 ≤ T ≤ 1000, 1 ≤ Y ≤ X ≤ 1000.

Here's how you can solve it:

  1. Multiply the prize money for the top 10 (X) by 10.
  2. Multiply the prize money for the participants ranked from 11 to 100 (Y) by 90 (since there are 90 participants in this range).
  3. Add the results from steps 1 and 2

This problem has been solved

Similar Questions

Input format :The first line contains an integer 't' representing the number of test cases.Each test case consists of a single line with two space-separated integers 'x' and 'y', representing the scores of Sasha and Brenda, respectively, for a particular round.Output format :For each test case, the output prints the result of that round.If x is greater than y, the output prints "Sasha".If x is equal to y, the output prints "Tie".Otherwise, the output prints "Brenda"

Four friends want to attend a concert. Each ticket costs 𝑋X rupees.They have decided to go to the concert if and only if the total cost of the tickets does not exceed 10001000 rupees.Determine whether they will be going to the concert or not.Input FormatThe first line of input will contain a single integer 𝑇T, denoting the number of test cases.Each test case consists of a single integer 𝑋X, the cost of each ticket.Output FormatFor each test case, output YES if they will be going to the concert, NO otherwise.You can print each character in uppercase or lowercase. For example, the strings YES, yes, Yes, and yES, are all considered identical.Constraints1≤𝑇≤1001≤T≤1001≤𝑋≤10001≤X≤1000Sample 1:InputOutput41005002501000YESNOYESNOExplanation:Test case 11: The total cost of all tickets is 100⋅4=400100⋅4=400 which is ≤1000≤1000. Thus, they will go to the concert.Test case 22: The total cost of all tickets is 500⋅4=2000500⋅4=2000 which is >1000>1000. Thus, they will not go to the concert.Test case 33: The total cost of all tickets is 250⋅4=1000250⋅4=1000 which is ≤1000≤1000. Thus, they will go to the concert.Test case 44: The total cost of all tickets is 1000⋅4=40001000⋅4=4000 which is >1000>1000. Thus, they will not go to the concert.

Julia just finished conducting a coding contest, and she needs your help assembling the leaderboard! Write a query to print the respective hacker_id and name of hackers who achieved full scores for more than one challenge. Order your output in descending order by the total number of challenges in which the hacker earned a full score. If more than one hacker received full scores in same number of challenges, then sort them by ascending hacker_id.Input FormatThe following tables contain contest data:Hackers: The hacker_id is the id of the hacker, and name is the name of the hacker. Difficulty: The difficult_level is the level of difficulty of the challenge, and score is the score of the challenge for the difficulty level. Challenges: The challenge_id is the id of the challenge, the hacker_id is the id of the hacker who created the challenge, and difficulty_level is the level of difficulty of the challenge. Submissions: The submission_id is the id of the submission, hacker_id is the id of the hacker who made the submission, challenge_id is the id of the challenge that the submission belongs to, and score is the score of the submission. Sample InputHackers Table: Difficulty Table: Challenges Table: Submissions Table: Sample Output

You did such a great job helping Julia with her last coding contest challenge that she wants you to work on this one, too!The total score of a hacker is the sum of their maximum scores for all of the challenges. Write a query to print the hacker_id, name, and total score of the hackers ordered by the descending score. If more than one hacker achieved the same total score, then sort the result by ascending hacker_id. Exclude all hackers with a total score of from your result.Input FormatThe following tables contain contest data:Hackers: The hacker_id is the id of the hacker, and name is the name of the hacker. Submissions: The submission_id is the id of the submission, hacker_id is the id of the hacker who made the submission, challenge_id is the id of the challenge for which the submission belongs to, and score is the score of the submission. Sample InputHackers Table: Submissions Table: Sample Output4071 Rose 19174842 Lisa 17484072 Bonnie 1004806 Angela 8926071 Frank 8580305 Kimberly 6749438 Patrick 43ExplanationHacker 4071 submitted solutions for challenges 19797 and 49593, so the total score .Hacker 74842 submitted solutions for challenges 19797 and 63132, so the total score Hacker 84072 submitted solutions for challenges 49593 and 63132, so the total score .The total scores for hackers 4806, 26071, 80305, and 49438 can be similarly calculated.

"Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score..." — an excerpt from contest rules.A total of n participants took part in the contest (n ≥ k), and you already know their scores. Calculate how many participants will advance to the next round.InputThe first line of the input contains two integers n and k (1 ≤ k ≤ n ≤ 50) separated by a single space.The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 100), where ai is the score earned by the participant who got the i-th place. The given sequence is non-increasing (that is, for all i from 1 to n - 1 the following condition is fulfilled: ai ≥ ai + 1).OutputOutput the number of participants who advance to the next round.ExamplesinputCopy8 510 9 8 7 7 7 5 5outputCopy6inputCopy4 20 0 0 0outputCopy0NoteIn the first example the participant on the 5th place earned 7 points. As the participant on the 6th place also earned 7 points, there are 6 advancers.In the second example nobody got a positive score.

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.