A C

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6133 Accepted Submission(s): 4018

Problem Description
Are you excited when you see the title “AC” ? If the answer is YES , AC it ;

You must learn these two combination formulas in the school . If you have forgotten it , see the picture.

Now I will give you n and m , and your task is to calculate the answer .

Input
In the first line , there is a integer T indicates the number of test cases.
Then T cases follows in the T lines.
Each case contains a character ‘A’ or ‘C’, two integers represent n and m. (1<=n,m<=10)

Output
For each case , if the character is ‘A’ , calculate A(m,n),and if the character is ‘C’ , calculate C(m,n).
And print the answer in a single line.

Sample Input
2
A 10 10
C 4 2

Sample Output
3628800
6

Author
linle

Source
HDU 2007-1 Programming Contest

Source
2008 “Shun Yu Cup” Zhejiang Collegiate Programming Contest - Warm Up(1)

问题链接:HDU1570 A C
问题简述:(略)
问题分析
    排列组合数计算问题,大水题。还是打表吧,不然毫无技术含量。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C语言程序如下:

/* HDU1570 A C */#include <stdio.h>#define N 10
long long fact[N + 1];void init()
{int i;fact[1] = fact[0] = 1;for(i = 2; i <= N; i++)fact[i] = fact[i - 1] * i;
}int main(void)
{init();int t, n, m;char c;scanf("%d%*c", &t);while(t--) {scanf("%c%d%d%*c", &c, &n, &m);long long a = fact[n] / fact[n - m];printf("%lld\n", c == 'A' ?  a : a / fact[m]);}return 0;
}

HDU1570 A C【水题】相关推荐

  1. 水题/poj 1852 Ants

    1 /* 2 PROBLEM:poj1852 3 AUTHER:Nicole 4 MEMO:水题 5 */ 6 #include<cstdio> 7 using namespace std ...

  2. HDU2673-shǎ崽(水题)

    如果不能够直接秒杀的题,就不算水题.又应证了那句话,有时候,如果在水题上卡住,那么此题对于你来说,也就不算是水题了额~~ 刚睡醒,迷迷糊糊. 题目的意思很简单,求一个最大的,再求一个最小的.几乎是什么 ...

  3. 图论刷水题记录(二)(最短路-----SPFA算法)

    继第一篇的后续,又来刷水题了,写的是SPFA算法,这个算法的复杂度比较玄学,感觉能不用就不用了,但是他的好处就是可以判断负圈. 3月26日: 1.POJ 1847 Tram 题意:在一个交通网络上有N ...

  4. 图论刷水题记录(一)(最短路-----dijkstra算法)

    最近实在不知道干些什么,感觉自己除了水题什么都不会做,算了去刷一刷图论的水题吧本来想合起来一起发,想了想太长的话以后看起来也不方便,题目所以今天晚上就先发了dij部分,由上到下由易变难. 1.POJ ...

  5. hdu 2041:超级楼梯(水题,递归)

    超级楼梯Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submissio ...

  6. HDU2568 前进【水题】

    前进 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...

  7. CF Round #426 (Div. 2) The Useless Toy 思维 水题

    题目链接: http://codeforces.com/contest/834/problem/A 题目描述: 输入起始状态和结束状态和数列长度, 判断旋转方向是顺时针逆时针还是不合理 解题思路: 长 ...

  8. NUC1312 Sum【水题+数学题】

    Sum 时间限制: 1000ms 内存限制: 65536KB 通过次数: 1总提交次数: 1 问题描述 认为自然数是从1-N.将每个数和+或-联系起来,然后计算这个表达式的值我们得到一个和S.这个问题 ...

  9. Codeforces 864 A Fair Game 水题

    题目链接: http://codeforces.com/problemset/problem/864/A 题目描述: 看不是是不是一串数中只有两种数且这两种数字的数量是相同的 解题思路: 水题, 水过 ...

  10. poj1564 Sum It Up dfs水题

    题目描述: Description Given a specified total t and a list of n integers, find all distinct sums using n ...

最新文章

  1. 【SQL】sql语句GROUP BY
  2. Okhttp3中设置超时的方法
  3. 图像处理实战 多张曲线同图共舞
  4. win7系统cocos2dx 3.4 绑定自定义类到Lua
  5. 20180918-1 词频统计
  6. python爬虫实战(1)——爬取知乎热门回答图片
  7. java多线池_java多线程之线程池
  8. 怎么将音频原始文件导入matlab,Matlab2019b音频文件读取
  9. 需要一个用于Postgres的UUID生成器?这里有两种设置方法
  10. 主机电子游戏攻略资源分享
  11. 六轴传感器icm20602的自检和校准学习
  12. 手机号正则(2020年4月15日)
  13. 用Android studio 做出QQ登录界面
  14. 带自动还原魔方游戏源码
  15. 快来带您了解中秋节的前世今生
  16. No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK .
  17. 网站前台静态页面html模板
  18. 【最佳实践】gorm 联表查询 joins
  19. 怎样成长为更好的自己--《靠谱:顶尖咨询师教你的工作基本功》
  20. java输出三维数组

热门文章

  1. oracle 主键 字典表,oracle 增 删 改 查 新建表 主键 序列 数据字典
  2. 网站锁定php文件命令,PHP文件的锁定机制
  3. 基于VUE2.0的分页插件
  4. Kubernetes-存储卷Volume
  5. 一张图彻底了解Unity脚本的生命周期
  6. Accept是又产生一个Socket端口吗?
  7. java集合输入存储_Java练习IO流使用Properties集合存储数据并...
  8. Spark on YARN 两种模式yarn-cluster yarn-client 面试题
  9. TODO算子-双Value类型
  10. OpenCV——高效遍历图像(C++版本)