U295667 音乐

· · 个人记录

暴力思路

#include<bits/stdc++.h> 
using namespace std;
long long int d,a,s,p=0;
void ppp(int z,int x){
    if(z==a){p++;return;}
    if(x==d){return;}
    if((x<s&&z<1)||x>=s)ppp(z+1,x+1);
    ppp(z,x+1);
}
int main(){
    ios::sync_with_stdio(0);
    cin>>a>>s>>d;
    ppp(0,0); 
    if(p==10)p=9;
    cout<<p<<endl;
    return 0;
}