返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. long long compute(long long a,long long b){
  4.     if(b>6*a || b<0 || a<0){
  5.         return 0;
  6.     }else if(a==1){
  7.         if(b<=6 && b>=1){
  8.             return 1;
  9.         }else{
  10.             return 0;
  11.         }
  12.     }else{
  13.         return compute(a-1,b-1)+compute(a-1,b-2)+compute(a-1,b-3)+compute(a-1,b-4)+compute(a-1,b-5)+compute(a-1,b-6);
  14.     }
  15. }

  16. int main()
  17. {
  18.     long long a,b;
  19.     cin>>a>>b;
  20.     cout<<compute(a,b);
  21.     return 0;
  22. }
複製代碼

TOP

返回列表