Right after the explanations about Permutations and Combinations, there's a paragraph that says:

it is useful to know that

<img src="http://community.topcoder.com/i/education/combinatorics/combin11.jpg">

is also the number of integer solutions to this equation:

<img src="http://community.topcoder.com/i/education/combinatorics/combin12.jpg">

Could someone please explain to me this equation? How do I read it in natural language?

I have a particular problem with

Thank you in advance for all the help..

-J]]>

pls hlp..

here is my code...

#include <iostream>

#include <vector>

#include <set>

#include <map>

#include <algorithm>

#include <sstream>

#include <cmath>

#include <cstdio>

#include <string>

#include <queue>

#include <stack>

#include <deque>

#include <cstring>

#include <cstdlib>

#include <climits>

//#include <boost>

using namespace std;

#define FOR(I,A,B) for(int I= (A); I<(B); ++I)

#define REP(I,N) FOR(I,0,N)

#define S(N) scanf("%d", &N)

#define S_String(A) scanf("%s",A)

#define SL(N) scanf("%ld", &N)

#define SLL(N) scanf("%lld", &N)

#define PR(N) printf("%d\n",N)

#define PRL(N) printf("%ld\n",N)

#define PRLL(N) printf("%lld\n",N)

#define SPACE printf(" ")

#define NEW_LINE printf("\n")

typedef long long int LL;

typedef vector<int> VI;

double dp[10][120][300];

int runs,wickets,balls,target;

void convert_over(string str)

{

int overs=0,i=0,ball;

while(str[i]!='.')

{

overs=10*overs+str[i]-'0';

i++;

}

if(str[i]=='.')

{

ball=str[++i]-'0';

}

balls=6*overs+ball;

}

void convert_score(string str)

{

int i=0;

//bool flag=false;

runs=0;

wickets=0;

while(str[i]!='/')

{

runs=10*runs+str[i]-'0';

i++;

}

if(str[i]=='/')

{

wickets=10*wickets+str[++i]-'0';

}

}

double recursion(int balls, int reqRuns, int wickets)

{

if (reqRuns<=0)

return 1;

if (balls==120||wickets==10)

return 0;

if((int)dp[wickets][balls][reqRuns]>=0)

return dp[wickets][balls][reqRuns];

dp[wickets][balls][reqRuns]=(recursion(balls+1, reqRuns,wickets)+recursion(balls+1, reqRuns-1,wickets)+

recursion(balls+1, reqRuns-2,wickets)+recursion(balls+1, reqRuns-3,wickets)+

recursion(balls+1, reqRuns-4,wickets)+recursion(balls+1, reqRuns-5,wickets)+

recursion(balls+1, reqRuns-6,wickets)+recursion(balls+1, reqRuns,wickets+1)+

2*recursion(balls, reqRuns-1,wickets))/10;

return dp[wickets][balls][reqRuns];

}

void convert_ans(string str)

{

int i=0;

string str1="";

while(str[i]!='.')

{

str1=str1+str[i];

i++;

}

if(str[i]=='.')

{

str1=str1+str[i];

i++;

str1=str1+str[i];

i++;

str1=str1+str[i];

}

cout<<str1><<endl;

}

int main()

{

int t;

string score,overs;

S(t);

while(t--)

{

memset(dp,-1,sizeof dp);

cin>>overs;

convert_over(overs);

// cout<<balls><<endl;

cin>>score;

convert_score(score);

// cout<<score><<endl;

cin>>target;

if(runs>=target)

{

cout<<"100.00"<<endl;

continue;

}

else if(wickets==10)

{

cout><<"0.00"<<endl;

continue;

}

double finalAns=recursion(balls,target-runs,wickets)*100;

stringstream s;

s><<finalAns;

string st=s.str();

//cout<<s[2]><<endl;

convert_ans(st);

// printf("%.2lf\n",finalAns);

}

}]]>

There are exactly N advertising boards on the highway from main city. Now a company want to advertise on some of these advertising boards(each advertising board costs some money) .

Company strategy is that, they want at least 'K' advertisement should be there among M consecutive advertising boards. But at the same time Company want to pay minimum for its advertisement .

Now, what is the total number of ways, different ways Company can advertise meeting its minimum cost strategy.

As for Example:

N= 3, M = 2, K=1 ==>

there is only one way for minimum cost, ie. 0C0 , where '0' denotes No company advertisement, and 'C' denotes company advertisement board.

Similarly, for N =4, M =2, K =1 ==>

there is 3 possible ways, ie. C0C0, 0C0C, 0CC0.

Hope to get a reply from someone soon.

Thanks.]]>

EDIT : Here is the problem http://www.topcoder.com/stat?c=problem_statement&pm=2013]]>

Thanks in advance!]]>

What is a Dyck word? It's a string consisting only of n X’s and n Y’s, and matching this criteria: each prefix of this string has more X’s than Y’s

It should be each prefix of this string has more than

Anyway, it is nice article, great job :)]]>

You can think of 3 prizes to 2 people this way:

1: abc

2:

1: ab

2: c

1: ac

2: b

1: a

2: bc

and you get 4 more flipping person 1 and person 2.]]>

x,y,z are the prizes and a,b are people

so you have

xx,xy,xz,yy,yx,yz,zz,zx,zy

this is 3^2 and not 2^3

I still doubt the 5^10 and I think it is 10^5

It could have been of great help if the question

( 10 prizes distributed among five people) listed any other assumptions or is the example related to another explanation?]]>