結果

問題 No.665 Bernoulli Bernoulli
ユーザー tecchaxntecchaxn
提出日時 2018-03-10 11:13:24
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 547 bytes
コンパイル時間 1,448 ms
コンパイル使用メモリ 159,268 KB
実行使用メモリ 10,144 KB
最終ジャッジ日時 2024-04-21 00:58:37
合計ジャッジ時間 5,025 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,448 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;

//-----------------------------------------------------------------------

const int mod=1e9+7;
int mod_pow(int x,int n)
{
    int res=1;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

signed main()
{
    int N,K; cin>>N>>K;

    int ans=0;
    for(int i=1;i<=N;i++){
        ans+=mod_pow(i,K);
        ans%=mod;
    }
    cout<<ans<<endl;

}
0