Sum of fractions P76024


Statement
 

pdf   zip

thehtml

Write a program that reads triples of natural numbers a, b and k, and for each one computes and prints the result of

1
a
 + 
1
a+k
 + 
1
a+2k
 + …

for all fractions with denominator smaller than or equal to b.

Input

Input consists of several triples of natural numbers a, b and k, such that 1 ≤ ab and k ≥ 1.

Output

For each triple, print in a line the result of the sum with four digits after the decimal point.

Public test cases
  • Input

    1 3 1
    5 5 2
    5 6 2
    5 7 2
    

    Output

    1.8333
    0.2000
    0.2000
    0.3429
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python