Time Exceeded
代码
#include<iostream>
#define maxn 1000
using namespace std;
typedef long long ll;
int n,m;
ll ans=0,EDG=1e9+7;
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
{
ll temp=i;
ans=(ans+temp)%EDG;
for(int j=1;j<m;j++)
{
temp=temp*i%EDG;
ans=(ans+temp)%EDG;
///cout<<"ans="<<ans<<endl;
}
}
cout<<ans<<endl;
return 0;
}