結果
| 問題 | 
                            No.1518 Simple Combinatorics
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-05-02 12:37:12 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 16 ms / 2,000 ms | 
| コード長 | 326 bytes | 
| コンパイル時間 | 3,977 ms | 
| コンパイル使用メモリ | 250,056 KB | 
| 最終ジャッジ日時 | 2025-01-21 05:44:54 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
const int mod = 1e9 + 7;
int main() {
    int n, k;
    cin >> n >> k;
    mint ans = 0;
    ans += pow_mod(n, k, mod);
    ans -= pow_mod(n - 1, k, mod);
    ans *= n;
    cout << ans.val() << endl;
}