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. Bat 中特殊符号

    批处理.Bat 中特殊符号的实际作用,Windows 批处理中特殊符号的作用: @\\隐藏命令的回显. ~\\在for中表示使用增强的变量扩展:在set中表示使用扩展环境变量指定位置的字符串:在set ...

  2. [swustoj 443] Handsome Swap

    Handsome Swap(0443) Time limit(ms): 1000 Memory limit(kb): 65535 Submission: 89 Accepted: 20 Accepte ...

  3. UpdatePanel 无刷新弹出窗口

    UpdatePanel下解决提示框不弹出的方法 用户体验上既想页面不刷新,也希望同时能够看到操作的效果(弹出提示框)! ①不刷新,我们可以使用UpdatePanel ②弹出消息框,这个有很多的方式:我 ...

  4. spring--AOP1--6

    AOP 之 6.1 AOP基础 6.1.1  AOP是什么 考虑这样一个问题:需要对系统中的某些业务做日志记录,比如支付系统中的支付业务需要记录支付相关日志,对于支付系统可能相当复杂,比如可能有自己的 ...

  5. 多组 RadioButtonList 获取值

    <div class="row">    <table>        <thead><tr><th>操作</th ...

  6. 洛谷P1238 走迷宫

    洛谷1238 走迷宫 题目描述 有一个m*n格的迷宫(表示有m行.n列),其中有可走的也有不可走的,如果用1表示可以走,0表示不可以走,文件读入这m*n个数据和起始点.结束点(起始点和结束点都是用两个 ...

  7. linux 内存管理——内核的shmall 和shmmax 参数

    内核的 shmall 和 shmmax 参数 SHMMAX= 配置了最大的内存segment的大小 ------>这个设置的比SGA_MAX_SIZE大比较好. SHMMIN= 最小的内存seg ...

  8. 【原创】一个复制本地文件到Hadoop文件系统的实例

    import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net ...

  9. HW2.2

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  10. 使用WIF实现单点登录Part III —— 正式实战 -摘自网络

    经过前两篇文章,估计大家对WIF已经有比较充分的认识了,估计大家在经过了枯燥的理论以后,肯定是摩拳擦掌赶紧付诸于行动了.没办法,咱们程序员就是这个毛病.那好吧,我也不那么多废话了,直接进入正题吧. 我 ...