这道题需要用到排列组合的知识,不会的建议去看我的博客。
我们可以先从这 种金属入手。
对于任意一种金属,它可以被任意 个熔炉所造出来,方案总数为:
现在有 种金属,每一种金属有 种方法,总方案数为 ,配上快速幂模板即可。
#include<bits/stdc++.h>
#define int unsigned long long
#define endl '\n'
using namespace std;
const int mod = 998244353;
int ksm(int a, int b){
int ans = 1;
while(b){
if(b & 1)
ans = ans * a % mod;
b >>= 1;
a = a * a % mod;
}
return ans;
}
int32_t main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, k, ans = 0;
cin >> n >> k;
cout << ksm(ksm(2, k)-1, n) << endl;
return 0;
}