Parking Charges Solution Codechef
Chef needs to park her car while she watches a movie. The parking charges at the theater are as follows:
- Rs. � for the first 1 hour
- Rs. � for every extra hour after the first hour
If Chef parks her car for � hours, what is the total parking charges that she should pay?
Input Format
The only line of the input will contain three space separated integers – �, �, and �.
Output Format
Output a single integer, which should be the total amount that Chef pays as parking charge.
Constraints
- 1≤�≤100
- 1≤�≤100
- 1≤�≤100
Parking Charges Solution Codechef
Sample 1:
Explanation:
�=10, which means that for the first hour, Chef has to pay Rs. 10.
�=1, which means that for every extra hour, Chef has to pay Rs. 1.
Chef needs to park for �=5 hours.
So, for the first hour, she will pay Rs. 10. And for the 5−1=4 hours extra, she will pay 4∗1=Rs. 4. So in total, she has to pay 10+4= Rs. 14.
Sample 2:
Explanation:
�=1, which means that for the first hour, Chef has to pay Rs. 1.
�=10, which means that for every extra hour, Chef has to pay Rs. 10.
Chef needs to park for �=100 hours.
So, for the first hour, she will pay Rs. 1. And for the 100−1=99 hours extra, she will pay 99∗10=Rs. 990. So in total, she has to pay 1+990= Rs. 991.
Sample 3:
Parking Charges Solution Codechef
�=10, which means that for the first hour, Chef has to pay Rs. 10.
�=15, which means that for every extra hour, Chef has to pay Rs. 15.
Chef needs to park for �=1 hours.
So, for the first hour, she will pay Rs. 10. And she does not have to pay any more. So in total, she has to pay Rs. 10.