C++ Frog Jmp
#include <cmath>
long long frogJmp(long long x, long long y, long long d)
{
return static_cast<long long>(std::ceil(static_cast<double>(y - x) / d));
}
This computes the jump count with math instead of simulation, which is the cleanest way to solve it.