A C

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

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
 #include <iostream>
using namespace std;
int f[] = {, }; int main(){
for(int i = ; i < ; i++){
f[i] = i * f[i-];
}
int test, n, m;
char c;
cin >> test;
while(test--){
cin >> c >> n >> m;
if(c == 'A')
cout << f[n] / f[n - m] << endl;
else if(c == 'C')
cout << f[n] / f[m] / f[n - m] << endl;
}
return ;
}

hdu 1570 AC的更多相关文章

  1. hdu 2896 AC自动机

    // hdu 2896 AC自动机 // // 题目大意: // // 给你n个短串,然后给你q串长字符串,要求每个长字符串中 // 是否出现短串,出现的短串各是什么 // // 解题思路: // / ...

  2. hdu 3065 AC自动机

    // hdu 3065 AC自动机 // // 题目大意: // // 给你n个短串,然后给你一个长串,问:各个短串在长串中,出现了多少次 // // 解题思路: // // AC自动机,插入,构建, ...

  3. hdu 4057 AC自己主动机+状态压缩dp

    http://acm.hdu.edu.cn/showproblem.php?pid=4057 Problem Description Dr. X is a biologist, who likes r ...

  4. hdu 5880 AC自动机

    Family View Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total ...

  5. hdu 3247 AC自动+状压dp+bfs处理

    Resource Archiver Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 100000/100000 K (Java/Ot ...

  6. hdu 2296 aC自动机+dp(得到价值最大的字符串)

    Ring Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submis ...

  7. hdu 2825 aC自动机+状压dp

    Wireless Password Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  8. hdu 3065 AC自动机(各子串出现的次数)

    病毒侵袭持续中 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Sub ...

  9. 题解报告:hdu 1570 A C

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1570 Problem Description Are you excited when you see ...

随机推荐

  1. MySql配置参数很全的Mysql配置参数说明

    MySql配置参数 很全的Mysql配置参数说明 1. back_log 指定MySQL可能的连接数量.当MySQL主线程在很短的时间内得到非常多的连接请求,该参数就起作用,之后主线程花些时间(尽管很 ...

  2. Nginx反向代理+DNS轮询+IIS7.5 千万PV 百万IP 双线 网站架构案例

    原文地址:http://www.jb51.net/article/31844.htm Nginx  ("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 ...

  3. asp.net的运行内幕

    每当浏览器向IIS发送一个页面请求的时候,相应的网页就会被编译成DLL文件,然后由JIT来运行这个DLL文件,最后将运行结果发送给客户端.一旦网页发送了变化,下次再请求页面的话,网页又会被重新被编译成 ...

  4. 基于duilib实现的可滑动tab标签控件

    最近一直在忙棋牌游戏大厅的开发,使用了duilib界面库,在大厅界面游戏菜单的展现上需要用到滑动的效果,类似悠扬棋牌,jj棋牌的菜单左右(上下)滑动的效果.通过自己的设计思路完善了一个可滑动的tab标 ...

  5. Cocos2d-x获取随机数

    计算机是无法产生真正的随机数的,都是伪随机.获取随机数的方式和算法多种多样,这里只给出一种方法,基于最新的C++11. 1 2 3 4 5 #include <random> std::u ...

  6. 2015年10月22日CSS学习笔记

    XHTML1.0对HTML4.0的改进 借鉴了XML的写法,语法更加严格. 把页面的内容和样式分离了,废弃了html4中的表示样式的标签和属性.推荐使用css来描述页面的样式. CSS样式的优先级 ! ...

  7. 2014-5-23 s3c2440到手

    ( 之前的开发板是s5pv210  (contex  A8)); 现在入手JZ2440......................

  8. Devlop Win 8 and Windows Phone App for Microsoft Dynamics CRM

    Microsoft Dynamics CRM App for Windows Phone http://www.windowsphone.com/en-us/store/app/dynamics-cr ...

  9. POSIX-Centos查看rpm包安装位置及相关信息

    rpm -qifl `which svnserve`; http://www.ctohome.com/FuWuQi/56/122.html [国外服务器及ip租用价格] Centos6 kvm网桥配置 ...

  10. 数值类对象:NSNumber,NSValue,NSNull

    基本,集合,复杂,对象 可用对象封装基本数值,然后将对象放入NSArray或NSDictionary 中. 用对象封装基本数值后,即可给其发送消息. 数值类型包括:NSNumber,NSValue,N ...