A group of students wants to visit a tour in some city \(X\). In total, the group has \(N\) boys and \(M\) girls. To do this, they need to stay in a hotel.
Calculate the number of rooms you need to book in the hotel, if each hotel room has \(K\) seats, provided that the boys can not live with the girls in the same room.
Input format
- The first line specifies a number \(T\) denoting the number of test cases.
- In each line of the test case, there are three numbers, \(N,M,K\).
Output format
For each test case, print one number denoting the number of rooms to be booked at the hotel.
Constraints
\(1 ⩽ T ⩽ 10\)
\(0 ⩽ n, m ⩽ 1000\)
\(n + m > 0\)
\(1 ⩽ k ⩽ 1000\)
For test 13 7 2 answer is 11, because need for boys 7 rooms and for girls need 4 rooms.
For test 5 5 3 answer is 4, because need for boys 2 rooms and for girls need 2 rooms.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor