当k为0 时,任何数的0次幂都是1
而在你函数中 没有体现
加一句
long f2(int n,int k) { long power=n; int i; if(k == 0 ) return 1;for(i=1;ipower*=n; return power; }