Mock CCC '18 Contest 1 J3/S1 - A Math Problem

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 5.0s
Memory limit: 1G

Problem type

Given positive integers K, P, and X, compute the minimum possible value of f(M) = MX + \dfrac{KP}{M} given that M must be a positive integer.

Constraints

1 \le K, P, X \le 10\,000

Input Specification

The input consists of a single line containing three space-separated integers K, P, and X.

Output Specification

Print, on a single line, the minimum possible value of f subject to the above constraint, rounded to exactly three decimal places.

The input data will be set such that the correct answer will not be within 10^{-5} of the aforementioned rounding boundary.

Sample Input 1

31 41 59

Sample Output 1

549.200

Sample Input 2

3 4 5

Sample Output 2

16.000

Comments


  • 2
    sankeeth_ganeswaran  commented on May 5, 2019, 12:03 a.m. edited

    ...was my solution intended? I thought for sure that I needed some calculus for this or else I would TLE haha


    • 3
      discoverMe  commented on May 5, 2019, 12:50 a.m.

      nope, the problem is only 5 points, it's not supposed to be that hard!


  • -2
    Woofless77  commented on March 10, 2019, 5:08 a.m.

    How come I am getting the answers to be actually 15.492 and 547.682? I tested these answers and they seem to yield lower answers for f(M) which makes the test cases wrong. But I must be missing something... I initially thought maybe they only wanted the first decimal place but when I do that, I get some of the other answers wrong. So could someone tell me what is wrong with these answers?


    • 1
      Falseman1024  commented on May 3, 2019, 10:40 p.m.

      I am assuming you are directly applying AM-GM, and the inequality holds iff MX = \frac{KP}{M} but M may have non-integer solutions.


  • -2
    xjhlg123555  commented on Oct. 14, 2018, 12:41 a.m.

    How come derivative is not accurate enough?


    • 0
      ryanawad  commented on March 24, 2022, 9:20 p.m. edited

      Try ceiling or flooring certain values


    • -4
      andrewfeng123  commented on Jan. 23, 2019, 9:04 p.m.

      gotta use double