Banner Home Page Web Contests Problems Ranklist Status Statistics

Lucky Tickets

Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 32768/16384K (Java/Other)
Total Submission(s) : 4   Accepted Submission(s) : 1
Problem Description
You are given a number 1 ≤ N ≤ 50. Every ticket has its 2N-digit number. We call a ticket lucky, if the sum of its first N digits is equal to the sum of its last N digits. You are also given the sum of ALL digits in the number. Your task is to count an amount of lucky numbers, having the specified sum of ALL digits.
 

Input
<DIV CLASS="problem_par"><DIV CLASS="problem_par_normal">Two space-separated numbers: <i>N</i> and <i>S</i>. Here <i>S</i> is the sum of all digits. Assume that 0 ≤ <i>S</i> ≤ 1000. </DIV></DIV>
 

Output
<DIV CLASS="problem_par"><DIV CLASS="problem_par_normal">The amount of lucky tickets. </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 2 </PRE></TD><TD><PRE CLASS="intable">4 </PRE></TD></TR></TABLE><H3 CLASS="problem_subtitle">Hint</H3><DIV CLASS="problem_par"><DIV CLASS="problem_par_normal">The tickets are 0101, 0110, 1001, 1010 in the example above</DIV></DIV>
 

Statistic | Submit | Back