//https://www.luogu.com.cn/problem/P6075
#include<bits/stdc++.h>
#include<unordered_map>
#include<array>
#define ll long long
#define ull unsigned long long
#define all(a) a.begin(),a.end()
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const int N = 1e3 + 5;
ll qpow(ll base, ll pow)
{
ll ans = 1;
while (pow)
{
if (pow & 1)
ans = ans * base % mod;
pow >>= 1;
base = base * base % mod;
}
return ans;
}
void solve()
{
ll n, k;
cin >> n >> k;
cout << qpow(2, n * k % (mod - 1));//mod是质数,根据费马小定理,a^(p-1) ≡ 1(mod p)
}
signed main()
{
IOS;
int t = 1;
//cin >> t;
while (t--)
solve();
return 0;
}
P6075 [JSOI2015]子集选取, 计数1
最新推荐文章于 2025-05-01 21:36:18 发布