Banner Home Page Web Contests Problems Ranklist Status Statistics

Boxes

Time Limit : 1200/600ms (Java/Other)   Memory Limit : 32768/16384K (Java/Other)
Total Submission(s) : 1   Accepted Submission(s) : 1
Problem Description
N boxes are lined up in a sequence (1 ≤ N ≤ 20). You have A red balls and B blue balls (0 ≤ A ≤ 15, 0 ≤ B ≤ 15). The red balls (and the blue ones) are exactly the same. You can place the balls in the boxes. It is allowed to put in a box, balls of the two kinds, or only from one kind. You can also leave some of the boxes empty. It's not necessary to place all the balls in the boxes. Write a program, which finds the number of different ways to place the balls in the boxes in the described way.
 

Input
<DIV CLASS="problem_par"><DIV CLASS="problem_par_normal">Input contains one line with three integers <i>N</i>, <i>A</i> and <i>B</i> separated by space.</DIV></DIV>
 

Output
<DIV CLASS="problem_par"><DIV CLASS="problem_par_normal">The result of your program must be an integer written on the only line of output.</DIV></DIV>
 

Sample Input
<TABLE BORDER=1 CLASS="sample"><COL WIDTH="350"><COL WIDTH="350"><TR><TH>input</TH><TH>output</TH></TR><TR><TD><PRE CLASS="intable">2 1 1</PRE></TD><TD><PRE CLASS="intable">9</PRE></TD></TR></TABLE>
 

Source
First competition for selecting the Bulgarian IOI team.
 

Statistic | Submit | Back