AcWing 211. 计算系数
生活随笔
收集整理的這篇文章主要介紹了
AcWing 211. 计算系数
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
代碼如下:
#include <iostream> using namespace std; const int N = 1010; const int MOD = 10007; int c[N][N]; typedef long long LL; int power(int a,int b) {int res = 1;a = a%MOD;while(b--) res = res*a%MOD;return res; }int main() {int a,b,k,n,m;cin>>a>>b>>k>>n>>m;for (int i = 0;i<=k;i++)for (int j = 0;j<=i;j++){if (!j) c[i][j] = 1;else{c[i][j] = (c[i-1][j]+c[i-1][j-1])%MOD;}}cout<<c[k][n]*power(a,n)%MOD*power(b,m)%MOD<<endl;return 0; }總結
以上是生活随笔為你收集整理的AcWing 211. 计算系数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 安卓工业一体机修改开机动画安卓工业一体机
- 下一篇: AcWing 312. 乌龟棋