package com.thinker.bishi.offer;

/**
 * @author lzh
 */
public class Offer_11 {

    public static double power(int expo,double base){
        if(expo <= 0){
            return 1;
        }
        double result;
        if((expo%2) == 0){
            result = power(expo>>1, base)*power(expo>>1, base);
        }else {
            result = power((expo-1)>>1, base)*power((expo-1)>>1, base)*base;
        }
        return result;
    }

    public static void main(String[] args) {
        double result = power(3,3);
        System.out.println(result);
    }
}
