杨辉三角与二项式定理的应用~~~~不解释。。。。。
AC代码:
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#define N 11
using namespace std;
int dp[N][N];
int ss[N]={0,1,2,6,24,120,720,5040,40320,362880,3628800};
void init()
{
memset(dp,0,sizeof(dp));
for(int i=0;i<N;++i)
{
dp[i][0]=1;
for(int j=1;j<=i;++j)
dp[i][j]=dp[i-1][j-1]+dp[i-1][j];
}
}
int main()
{
int T;
scanf("%d",&T);
init();
while(T--)
{
char s[2];
scanf("%s",s);
int m,n;
scanf("%d%d",&n,&m);
if(s[0]=='A') printf("%d\n",dp[n][m]*ss[m]);
else if(s[0]=='C') printf("%d\n",dp[n][m]);
}return 0;
}
分享到:
相关推荐
动态规划:http://acm.zju.edu.cn/forum/viewtopic.php?t=69 搜索:http://acm.zju.edu.cn/forum/viewtopic.php?t=67 数论:http://acm.zju.edu.cn/forum/viewtopic.php?t=66 几何:...
浙江大学在线题库:http://acm.zju.edu.cn/problems.php 浙江工业大学在线题库:http://acm.zjut.edu.cn 衡阳市第八中学信息学奥赛论坛&zju译题站:http://61.187.179.132:82/ UVA在线题库:...
ACM大量习题题库 现在网上有许多题库,大多是可以在线评测,所以叫做Online Judge。除了USACO是为IOI准备外,其余几乎全 部是大学的ACM竞赛题库。 USACO http://ace.delos.com/usacogate 美国著名在线题库,专门为...
Input is a sequence of commands. The command keywords BACK, FORWARD, VISIT, and QUIT are all in uppercase. URLs have no whitespace and have at most 70 characters. You may assume that no problem ...
(我现在主要在CSDN上整理计算机安全、软件工程(可信软件)、系统及通信方面的论文及相关理论书籍,如果对这方面内容感兴趣,可以访问:http://qysh123.download.csdn.net/ 查看我上传的所有资料。内容比较多,需要...
3、林杰博客说明:http://linjie.org/2015/08/06/amr%E6%A0%BC%E5%BC%8F%E8%BD%ACmp3%E6%A0%BC%E5%BC%8F-%E5%AE%8C%E7%BE%8E%E8%A7%A3%E5%86%B3Linux%E4%B8%8B%E8%BD%AC%E6%8D%A20K%E9%97%AE%E9%A2%98/
Hdu 1020解题报告,http://acm.hdu.edu.cn/showproblem.php?pid=1020
http://acm.hdu.edu.cn/showproblem.php?pid=2020 绝对值排序 txt格式
TagRec won the best poster award @ Hypertext 2014 (HT'14) conference: http://ht.acm.org/ht2014/index.php?awards.poster TagRec is also a main part of the recommender systems in the Layers project ...
zju 1048 Financial Managementhttp://acm.zju.edu.cn/show_problem.php?pid=1048
HDU ACM 2005第几天 C++ http://acm.hdu.edu.cn/listproblem.php?vol=11 2005题 第几天?
http://blog.csdn.net/acmmmm
Mauro Pezzè是软件工程研究领域顶级期刊ACM Transactions on software engineering的副主编,同时是多个国际会议,如International Symposium on Software Testing and Analysis的委员会成员。 他领导的实验室主页...
(我现在主要在CSDN上整理计算机安全、软件工程(可信软件)、系统及通信方面的论文及相关理论书籍,如果对这方面内容感兴趣,可以访问:http://qysh123.download.csdn.net/ 查看我上传的所有资料。内容比较多,需要...
pc2-9.1.5-1969 acm pc2-9.1.5-1969 acm
湖南大学ACM-OJ的部分题目代码,对学习数据结构和算法很有帮助
本资源仅包含网页分割数据,其他资源,包括代码,模型,数据,文章可进入网页自行下载...ACM Transactions on Graphics (TOG) - Proceedings of ACM SIGGRAPH Asia 2016
几个程序设计的训练网站给大家,供大家参考! http://poj.org/ 北大的,比较难 http://acm.hdu.edu.cn/ 杭电的,相对容易 http://cm2prod.baylor.edu/welcome.icpc ACM/ICPC官方网站
zju 1025 Wooden Sticks http://acm.zju.edu.cn/show_problem.php?pid=1025
数据库课后习题答案 数据库课后习题答案 数据库课后习题答案 数据库课后习题答案