Problem
In a coding contest, there are prizes for the top rankers. The prize scheme is as follows:
- Top participants receive rupees each.
- Participants with rank to (both inclusive) receive rupees each.
Find the total prize money over all the contestants.
Input Format
- First line will contain , number of test cases. Then the test cases follow.
- Each test case contains of a single line of input, two integers and - the prize for top rankers and the prize for ranks to respectively.
Output Format
For each test case, output the total prize money over all the contestants.
Constraints
Sample 1:
Input
Output
4
1000 100
1000 1000
80 1
400 30
19000
100000
890
6700
Explanation:
Test Case : Top participants receive rupees and next participants receive rupees each. So, total prize money .
Test Case : Top participants receive rupees and next participants receive rupees each. So, total prize money .
Test Case : Top participants receive rupees and next participants receive rupee each. So, total prize money .
Test Case : Top participants receive rupees and next participants receive rupees each. So, total prize money .
Solution
#include <iostream>
using namespace std;
// Solution from : Code Radius [ https://radiuscode.blogspot.com/ ]
int main() {
int txP;
cin>>txP;
for(int index=0;index<txP;index++)
{
int xx,yx;
cin>>xx>>yx;
cout<<10*xx+90*yx<<endl;
}
return 0;
}
Please First Try to Solve Problem by Yourself.