Total Prize Money solution codechef

Total Prize Money solution codechef

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.
  • Edology is a global Ed-Tech brand that provides industry powered global education and certifications to students and professionals across the world, to help them fast-track their career growth. Edology is part of Global University Systems (GUS), an international network of higher-education institutions, brought together by a shared passion of making industry-driven global education accessible and affordable.

Find the total prize money over all the contestants.

Input Format

Total Prize Money solution codechef

  • 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.

Through this contest, selected students get access to a free 6 month LinkedIn Premium subscription which helps students:

  • Discover & apply to 20M+ jobs/internships on LinkedIn
  • Reach out to hiring managers/recruiters/mentors directly
  • Find career paths that people similar to them have taken
  • Learn from over 17K expert-led LinkedIn Learning courses (technical & soft-skills) with certificates

Constraints

  • 1T10001≤T≤1000
  • 1YX10001≤Y≤X≤1000

Sample Input 1

Total Prize Money solution codechef

4
1000 100
1000 1000
80 1 
400 30

Sample Output 1

19000
100000
890
6700

Explanation

  • Edology is a global Ed-Tech brand that provides industry powered global education and certifications to students and professionals across the world, to help them fast-track their career growth. Edology is part of Global University Systems (GUS), an international network of higher-education institutions, brought together by a shared passion of making industry-driven global education accessible and affordable.

Total Prize Money solution codechef

Test Case 11: Top 1010 participants receive rupees 10001000 and next 9090 participants receive rupees 100100 each. So, total prize money =101000+90100=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 =101000+901000=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 =1080+901=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 =10400+9030=6700=10⋅400+90⋅30=6700.

SOLUTION

Click here

Leave a Comment

Your email address will not be published.