省SD2017 G sum of power【water】

来源:互联网 发布:文字办公软件 编辑:程序博客网 时间:2024/06/10 16:17

sum of power

Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 12 Solved: 7
[Submit][Status][Discuss]
Description

这里写图片描述

Input

Input contains two integers n,m(1≤n≤1000,0≤m≤10).

Output

Output the answer in a single line.

Sample Input

10 0
Sample Output

10
HINT

Source

山东省第八届ACM程序设计大赛2017.5.7

//这题就是有毒
//出题少个0,不过分么
//怀疑鱼生

#include <iostream>#include <string>#include <algorithm>#include <cstring>#include <cstdio>#include <cmath>using namespace std;#define angel 0x3f3f3f3f#define mod 1000000007#define ll long long intll n,m;ll ans,t;int main(){    while(cin>>n>>m)    {        ans=0;        for(ll i=1;i<=n;i++)        {            t=1;            for(ll j=1;j<=m;j++)            {                t*=i;                t=t%mod;            }            ans+=t;            ans%=mod;        }        cout<<ans<<endl;    }    return 0;}