Home > Back-end >  Programming problem for help
Programming problem for help

Time:10-11

Regulations 198 by four positive integer addition, please calculate how many kinds of additive solution,

CodePudding user response:

Poor
For
Method

CodePudding user response:

Demolish scores can be repeated?

CodePudding user response:

You can, it has no limit

CodePudding user response:

 
Int nsplit (int n, int k)
{
Int I, r;

If (n & lt; 1 | | k & lt; 1 | | n & lt; K) return 0;
If (n==k | | k==1) return 1;
If (k==2) return n/2;
For (I=1, r=0; i <=k; I++) r +=nsplit (n - k, I);

return r;
}


Nsplit (198, 4)=54722 program

CodePudding user response:

references 4 floor early play play nuclear response:
 
Int nsplit (int n, int k)
{
Int I, r;

If (n & lt; 1 | | k & lt; 1 | | n & lt; K) return 0;
If (n==k | | k==1) return 1;
If (k==2) return n/2;
For (I=1, r=0; i <=k; I++) r +=nsplit (n - k, I);

return r;
}


Nsplit (198, 4)=54722 kinds of solutions

Wow?? Thank you thank you
  • Related