def ceiling_root(num, pwr):
    """
    Returns the integer ``num ** (1. / pwr)`` if num is a perfect square/cube/etc,
    or the integer ceiling of this value, if it's not.
    """
    res = num ** (1. / pwr)
    int_res = int(round(res))
    if int_res ** pwr == num:
        return int_res
    else:
        return int(res + 1)