[Solution] Ticket Fine CodeChef Solution | Solution CodeChef
Problem
On a certain train, Chef-the ticket collector, collects a fine of Rs. if a passenger is travelling without a ticket. It is known that a passenger carries either a single ticket or no ticket.
passengers are travelling and they have a total of tickets. Help Chef calculate the total fine collected.
Input Format
The first line contains a single integer , the number of test cases. lines follow. Each following line contains three integers separated by spaces, whose description follows.
- The first integer, , is the fee in rupees.
- The second integer, , is the number of passengers on the train.
- The third integer, , is the number of tickets Chef collected.
Output Format
The output must consist of lines.
- The line must contain a single integer, the total money(in rupees) collected by Chef corresponding to the test case.
Explanation:
Test case : The total number of passengers travelling without ticket are . So the total fine collected is rupees.
Test case : The total number of passengers travelling without ticket are . So the total fine collected is rupees.
Test case : The total number of passengers travelling without ticket are . So the total fine collected is rupees.
Test case : The total number of passengers travelling without ticket are . So the total fine collected is rupees.
No comments:
Post a Comment