Splitting some coins P12234


Statement
 

pdf   zip

thehtml

You have to split c coins among n people. You know that each individual will spend all the coins that he or she will receive by buying as many books as possible, each of them by a price of p coins. The remaining coins of each person will be lost. You want to know the minimum number of books that can be bought, and also the maximum.

For instance, with n = 2, c = 16 and p = 10, by giving 8 coins to each person, they can buy nothing. But dividing the coins in two groups of 12 and 4, the first person can buy one book. In this case the minimum is 0 and the maximum is 1.

Input

Input consists of several cases, each with n, c and p. All numbers are integers. You can assume that n and p are between 1 and 3000, and that c is between 1 and 109.

Output

For every case, print the minimum and the maximum number of books that can be bought.

Public test cases
  • Input

    2 16 10
    5 1000 100
    1 2 3
    

    Output

    0 1
    6 10
    0 0
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++ Python