“浪潮杯”山东省第八届ACM大学生程序设计竞赛 sum of power

#include <bits/stdc++.h>
using namespace std;
int mod=1e9+7;
int main()
{
int n,m;
scanf("%d%d",&n,&m);
long long ans=0;
for(int i=1;i<=n;i++)
{
    long long tmp=1;
    for(int j=1;j<=m;j++)
        tmp*=i,tmp%=mod;
    ans+=tmp;
    ans%=mod;
}
cout<<ans<<endl;
    return 0;
}



猜你喜欢

转载自blog.csdn.net/clx55555/article/details/80068051