Pagination
Easy · rating 900 · math
A list of results is split across pages. Read the total number of items t and the page size s. Print how many pages are needed to show every item.
Constraints: 0 ≤ t ≤ 109, 1 ≤ s ≤ 109
Editorial
Pagination computes how many fixed-size pages are needed to show every item — a ceiling division. Avoid floats: (total + size − 1) // size rounds up exactly and yields 0 when there are no items.
print((total + size - 1) // size)Complexity
Time: O(1). Space: O(1).