华为C++题目:输入N,M,求N+N^2+N^3+...+N^M的结果(取余1000000007),1<N<=65536,1<M<=100000,用快速幂算法解决。
题目:输入N,M,求N+N2+N3+…+N^M的结果(取余1000000007),1#include#includeusingnamespacestd;constintMOD=1000000007;//取余的模数//快速幂算法函数longlongquickPower(longlongbase,longlongexponent,longlongmod){longlongresult=1;//结果初始