HDU1570 AC

题目大意:排序HDU1570 AC_第1张图片原题链接


#include<cstdio>
#include<iostream>
using namespace std;
typedef unsigned int ll;
ll a(int n,int m)
{
    ll s=1;
    for(int i=n-m+1;i<=n;i++)
    s*=i;
    return s;
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int  n,m;
        char ch;
        ll ans;
        getchar();
        scanf("%c",&ch);//注意字符的输入规则
        getchar();
        scanf("%d%d",&n,&m);
       if(n<m)
        {
            printf("0\n");
            continue;
        }
        if(ch=='A')
        ans=a(n,m);
        else ans=a(n,m)/a(m,m);
        printf("%u\n",ans);
    }
   return 0;
}


你可能感兴趣的:(HDU,1570)