蓝桥杯2014C题

 

 

#include<iostream>
using namespace std;
int ans;
void f(int dian,int hua,int jiu)
{
    if(dian == 0 && hua == 0 && jiu == 1)
        ans++;
    if(dian > 0)
        f(dian - 1,hua,jiu * 2);
    if(hua > 0)
        f(dian,hua - 1,jiu - 1);
}

int main()
{
    f(5,9,2);
    cout << ans << endl;
    return 0;
}

简单的深搜

posted @ 2020-03-03 22:29  恶魔岛  阅读(80)  评论(0编辑  收藏  举报