結果
| 問題 | No.1049 Zero (Exhaust) | 
| コンテスト | |
| ユーザー |  tran0826 | 
| 提出日時 | 2020-03-24 15:57:40 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 13 ms / 2,000 ms | 
| コード長 | 681 bytes | 
| コンパイル時間 | 870 ms | 
| コンパイル使用メモリ | 97,944 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-23 09:55:11 | 
| 合計ジャッジ時間 | 1,993 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
ソースコード
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<stack>
#include<unordered_map>
#include<bitset>
#include<limits>
#include<array>
using namespace std;
#define MOD 1000000007
#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define REP(i,n) rep(i,0,n)
#define ll long long
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll p, k;
	cin >> p >> k;
	ll ans = 1, all = 1;
	REP(i, k) {
		ans = (2 * all % MOD + ans * (p - 1) % MOD) % MOD;
		all = all * 2 * p % MOD;
	}
	cout << ans << "\n";
	return 0;
}
            
            
            
        