hdu 4504 威威猫系列故事——篮球梦

http://acm.hdu.edu.cn/showproblem.php?pid=4504

dp也可以  组合也可以

下面是组合代码:

#include<iostream>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<algorithm>

#define LL long long

using namespace std;

const int INF=0x3f3f3f3f;
const int MOD=100000;
const LL LMOD=100000;
const int N=105;
const int M=105;
const int K=6;
LL C(int n,int m)
{
    LL tmp=1;
    for(int i=n-m+1;i<=n;++i)
    {
        tmp=tmp*i;
        while(m>=1&&tmp%m==0)
        {
            tmp=tmp/m;
            --m;
        }
    }
    return tmp;
}
int main()
{
    //freopen("data.in","r",stdin);
    int T,A,B;
    while(scanf("%d %d %d",&A,&B,&T)!=EOF)
    {
       int need=(T/15/2+B-A);
       int n=(T/15+1)/2;
       LL sum=0;
       for(int i=0;i<=n;++i)
       for(int j=0;j<=n;++j)
       {
          if(i+j*2+(n-i-j)*3>need)
          {
             sum+=(C(n,i)*C(n-i,j));
          }
       }
       cout<<sum<<endl;
    }
    return 0;
}

  

 

转载于:https://www.cnblogs.com/liulangye/archive/2013/03/23/2976884.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值