【题目链接】:http://noi.qz5z.com/viewtask.asp?id=z04

【题解】



用二项式定理可以写出下列通式



组合数可以用杨辉三角搞出来;

a的x次方直接乘就好了;指数也不大.

k可能会0;

所以c[0][0]=1不要忘了;不然会WA;

a很大。平方一下可能会爆int,注意开long long



【完整代码】

#include <cstdio>
#define LL long long using namespace std; const int MAXN = 1000+100;
const int MOD = 10007; int c[MAXN][MAXN];
int a,b,k,n,m; int main()
{
//freopen("F:\\rush.txt","r",stdin);
c[0][0] = 1;
for (int i = 1;i <= 1000;i++)
c[i][i] = c[i][0] = 1;
for (int i = 1;i <= 1000;i++)
for (int j = 1;j<= i-1;j++)
c[i][j] = (c[i-1][j]+c[i-1][j-1])%MOD;
scanf("%I64d%I64d%d%d%d",&a,&b,&k,&n,&m);
LL temp = 1;
for (int i = 1;i <= k-m;i++)
temp = (temp*a)%MOD;
LL temp1 = 1;
for (int i = 1;i <= m;i++)
temp1 = (temp1*b)%MOD;
temp = (temp*temp1)%MOD;
temp = (c[k][m]*temp)%MOD;
printf("%I64d\n",temp);
return 0;
}

最新文章

  1. 个人关于React的一些理解
  2. WPF,Silverlight与XAML读书笔记第四十六 - 外观效果之三皮肤与主题
  3. 《Continuous Delivery》 Notes 2: Configuration Management
  4. FingerGestures 屏蔽NGUI的方法
  5. 编译Ngnix遇到的问题,查看程序依赖的库文件
  6. Lazarus IDE的几个小技术
  7. 97、进入ScrollView根布局页面,直接跳到页面底部,不能显示顶部内容
  8. QTP10&amp;QTP11&amp;UFT11.5的安装和破解
  9. Foundation和UIKit框架图
  10. 【绿茶书情】:《SOHO小报》和《凤… - 绿茶的日志 - 网易博客
  11. Atom power-mode
  12. Cocos2d-x 3.0final手机游戏开发视频教程2014 - 自学编程 -(陆续更新中)
  13. zTree实现删除树节点
  14. KVM -&gt; 虚拟机磁盘管理_03
  15. 和我一起打造个简单搜索之ElasticSearch集群搭建
  16. 荔枝FM 字体文件 IconFontTextView
  17. koa2实现简单的图片上传
  18. [转帖学习] 使用阿里云证书 升级https
  19. win 7 浏览器被篡改小插曲
  20. pygame --- 可怜的小乌龟

热门文章

  1. 在kafka/config/目录下面有3个配置文件参数说明(producer.properties。consumer.properties。server.properties)
  2. Elasticsearch之源码分析(shard分片规则)
  3. Statement和ResultSet
  4. Spring模块作用
  5. 【Codeforces Round #456 (Div. 2) C】Perun, Ult!
  6. FZU 1921 栀子花开
  7. 使用PyCharm安装第三方库
  8. JavaScript学习总结(5)——Javascript面向(基于)对象编程
  9. 4. Spring Boot 过滤器、监听器
  10. 104.tcp多线程读写实现群聊