Excursion
Practice
3.6 (27 votes)
Implementation
Basic programming
Basic math
Problem
93% Success 8756 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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\)

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
97 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyGreedy AlgorithmsImplementation
Points:20
9 votes
Tags:
Hash functionAd-HocImplementationHash tableOpenApprovedEasy
Points:20
8 votes
Tags:
ApprovedBasic ProgrammingBasics of ImplementationEasyGrammar-VerifiedImplementationMapsReadyRecruitSets