比赛 防止颓废的小练习v0.15 评测结果 AAAAAAWAAW
题目名称 计算系数 最终得分 80
用户昵称 rewine 运行时间 0.016 s
代码语言 C++ 内存使用 4.20 MiB
提交时间 2016-10-17 17:14:01
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>

using namespace std;

int f[1009][1009];

const int mod = 10007;
int a,b,k,n,m;

int main() {
	freopen("factor.in","r",stdin);
    freopen("factor.out","w",stdout);	
    cin >> a >> b >> k >> n >> m;
	f[0][0] = 1;
	for (int i = 1;i <= n; i++)
	  f[i][0] = f[i-1][0]*a%mod;
	for (int j = 1; j <= m; j++)
	  f[0][j] = f[0][j-1]*b%mod;
	for (int i = 1; i <= n; i++)
	  for (int j = 1; j <= m; j++)
	    f[i][j] = (f[i-1][j]*a+f[i][j-1]*b)%mod;
	cout<<f[n][m]; 
	return 0;
}