Automatic Tuner X36434


Statement
 

pdf   zip

html

Input

One line of a decimal positive value bounded between 20.0 and 20,000.0.

Output

The output of this problem is made by three lines: * First line the identified note corresponding to the input frequency * Second line the closest note with the proper octave frequency * Third line the correction to make the input frequency sound perfectly pitched. If the input frequency is already perfectly pitched, then the output may be slightly different. Check the examples!

In case the frequency given lays just in the middle of two notes, it is preferable to increase the frequency instead of decreasing.

All values must be rounded to one decimal.

Public test cases
  • Input

    999
    

    Output

    Input note: B (999.0 Hz)
    Closest note: B (987.8 Hz)
    Decrease frequency in 11.2 Hz
    
  • Input

    20.0

    Output

    Input note: E (20.0 Hz)
    Closest note: E (20.6 Hz)
    Increase frequency in 0.6 Hz
  • Input

    19000.0
    

    Output

    Input note: D (19000.0 Hz)
    Closest note: D (18796.8 Hz)
    Decrease frequency in 203.2 Hz
    
  • Input

    24
    

    Output

    Input note: G (24.0 Hz)
    Closest note: G (24.5 Hz)
    Increase frequency in 0.5 Hz
    
  • Input

    2341
    

    Output

    Input note: D (2341.0 Hz)
    Closest note: D (2349.6 Hz)
    Increase frequency in 8.6 Hz
    
  • Input

    586
    

    Output

    Input note: D (586.0 Hz)
    Closest note: D (587.4 Hz)
    Increase frequency in 1.4 Hz
    
  • Input

    55
    

    Output

    Input note: A (55.0 Hz)
    Closest note: A (55.0 Hz)
    Pitch Perfect!
    
  • Input

    632
    

    Output

    Input note: E (632.0 Hz)
    Closest note: E (659.2 Hz)
    Increase frequency in 27.2 Hz
    
  • Information
    Author
    HP CodeWars
    Language
    English
    Official solutions
    Python
    User solutions
    C++ Python