下面代码实现了计算 xnx^nxn 的快速幂算法,该算法体现的编程思想是( )。
long long power(long long x, int n) { if (n == 0) return 1; long long res = power(x, n / 2); if (n % 2 == 0) return res * res; else return res * res * x; }
枚举
贪心
分治
模拟