-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTCKTFINE (Difficulty-373).java
More file actions
34 lines (27 loc) · 1 KB
/
TCKTFINE (Difficulty-373).java
File metadata and controls
34 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner scanner = new Scanner(System.in);
// Read the number of test cases
int T = scanner.nextInt();
// Process each test case
for (int i = 0; i < T; i++) {
// Read X, P, and Q for the current test case
int X = scanner.nextInt(); // Fine per passenger without ticket
int P = scanner.nextInt(); // Total number of passengers
int Q = scanner.nextInt(); // Number of tickets collected
// Calculate the number of passengers without tickets
int passengersWithoutTicket = P - Q;
// Calculate the total fine collected
int totalFine = passengersWithoutTicket * X;
// Output the total fine for the current test case
System.out.println(totalFine);
}
scanner.close();
}
}