Total Prize Money CodeChef Solution

Problem – Total Prize Money CodeChef Solution

In a coding contest, there are prizes for the top rankers. The prize scheme is as follows:

  • Top 10 participants receive rupees X each.
  • Participants with rank 11 to 100 (both inclusive) receive rupees Y each.

Find the total prize money over all the contestants.

Input Format

  • First 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 10 rankers and the prize for ranks 11 to 100 respectively.

Output Format

For each test case, output the total prize money over all the contestants.

Constraints

  • 1 \leq T \leq 10001≤T≤1000
  • 1 \leq Y \leq X \leq 10001≤YX≤1000

Sample 1:

Input: 4
1000 100
1000 1000
80 1
400 30
Output: 19000
100000
890
6700

Explanation:

Test Case 1: Top 10 participants receive rupees 1000 and next 90 participants receive rupees 100 each. So, total prize money = 10 \cdot 1000 + 90 \cdot 100 = 19000=10⋅1000+90⋅100=19000.

Test Case 2: Top 10 participants receive rupees 1000 and next 90 participants receive rupees 1000 each. So, total prize money = 10 \cdot 1000 + 90 \cdot 1000 = 100000=10⋅1000+90⋅1000=100000.

Test Case 3: Top 10 participants receive rupees 80 and next 90 participants receive rupee 1 each. So, total prize money = 10 \cdot 80 + 90 \cdot 1 = 890=10⋅80+90⋅1=890.

Test Case 4: Top 10 participants receive rupees 400 and next 90 participants receive rupees 30 each. So, total prize money = 10 \cdot 400 + 90 \cdot 30 = 6700=10⋅400+90⋅30=6700.

Total Prize Money CodeChef Solution in Python3

for _ in range(int(input())):
    x, y = map(int,input().split())
    print(10*x + 90*y)

Total Prize Money CodeChef Solution in C++17

#include <bits/stdc++.h>
using namespace std;
int main () {
int x,y,t;
cin>>t;
while (t--)
{ 
cin>>x>>y;
cout << x*10 + y*90 <<endl;
}
 }
 

Total Prize Money CodeChef Solution in Java


import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i=1; i<=n; i++){
		    int x = sc.nextInt();
		    int y = sc.nextInt();
		    System.out.println((x*10) + (y*90));
		}
	}
}
Total Prize Money CodeChef Solution Review:

In our experience, we suggest you solve this Total Prize Money CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Total Prize Money CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Total Prize Money CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.