Total Prize Money: PRIZEPOOL

Total Prize Money Codechef Solution

CU Submission link:

Public Submission link:

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

  • Top 1010 participants receive rupees XX each.
  • Participants with rank 1111 to 100100 (both inclusive) receive rupees YY each.

Find the total prize money over all the contestants.

Input Format

  • First line will contain TT, number of test cases. Then the test cases follow.
  • Each test case contains of a single line of input, two integers XX and YY – the prize for top 1010 rankers and the prize for ranks 1111 to 100100 respectively.

Output Format

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


  • 1≤T≤10001≤T≤1000
  • 1≤Y≤X≤10001≤Y≤X≤1000

Sample Input 1 

1000 100
1000 1000
80 1
400 30

Sample Output 1 



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.

Total Prize Money Codechef Solution in JAVA

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
	public static void main (String[] args) throws java.lang.Exception
		// your code goes here
		 Scanner in=new Scanner(;
	   int t=in.nextInt();
	    int x=in.nextInt();
	    int y=in.nextInt();

Total Prize Money Codechef Solution in C++

int main() {
	// your code goes here
	int t;
	while (t--){
	    int x,y;
	    cout<< (10*x)+(90*y)<< endl;
	return 0;

* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first. COPYING MATERIALS IS STRICTLY PROHIBITED.

Click here for more CodeChef problems and solutions

More from PROGIEZ