Heart Rate

From programming_contest
Jump to: navigation, search

This problem asks what the minimum and maximum frequency of a signal would be given the measured cycles in a given time span.

The minimum frequency will be if a cycle started just after we started measuring, and finished just before we stopped. This means we have had one fewer complete cycle than we actually measured. The maximum frequency is the opposite, and we have one extra cycle.

Then it's just floating point division.