HDU 1570-A C(暴力)

来源:互联网 发布:引力波爱因斯坦知乎 编辑:程序博客网 时间:2024/06/05 01:06

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1570

题意:求组合数   数据很小水过。

code:

#include<cstdio>#include<iostream>using namespace std;int main(){    int a[15],nn=1;    for(int i=1;i<12;i++){        nn*=i;        a[i]=nn;    }    a[0]=1;    int t,n,m;    char c;    cin>>t;    while(t--){        cin>>c>>n>>m;        if(c=='A')            printf("%d\n",a[n]/a[n-m]);        else if(c=='C')            printf("%d\n",a[n]/a[m]/a[n-m]);    }    return 0;}


原创粉丝点击