ENG  RUS Timus Online Judge Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1036. Lucky Tickets

I get WA#3.What is the right answer for this tests?
Posted by Enigma [UB of TUIT] 19 Nov 2010 11:52
2 4
2 6
2 8
4 2
4 4
4 6
4 8
Re: I get WA#3.What is the right answer for this tests?
Posted by Israel Batista 22 Jan 2011 04:52
In: 2 4
Out: 9

In: 2 6
Out: 16

In: 2 8
Out: 25

In: 4 2
Out: 16

In: 4 4
Out:100

In: 4 6
Out: 400

In: 4 8
Out: 1225

:)
WA3 guess
Posted by S.77 9 Aug 2011 03:54
As far as I guess, the right answer for WA3 is zero. And it comes up when, for instance, you have "N=2" and "S=38". Four bits cannot produce the sum more then thirty six, you know.
Re: I get WA#3.What is the right answer for this tests?
Posted by Raman Gupta 5 Oct 2012 20:45
My answers are same for all the test cases you have written here.
My recursive formula is m[len][sum] = m[len-1][sum-k] for 0<=k<=9.
Then why is it showing wrong anwser for test case 2.

#include <stdio.h>

long long arr;

main(){
int n,s,i,j,k;
scanf("%d %d",&n,&s);
/* for(i=1;i<=50;i++)
for(j=0;j<1001;j++) arr[i][j] = 0;*/

for(i=0;i<=9;i++) arr[i] = 1;

for(i=2;i<=n;i++){
for(j=0;j<=s;j++){
arr[i][j] = 0;
for(k=0;k<=9;k++){
if(j-k<0) break;
arr[i][j]+= arr[i-1][j-k];
}
}
}
printf("%lld\n",arr[n][(s+1)/2]*arr[n][s/2]);
return 0;
}

Edited by author 05.10.2012 20:46
Re: I get WA#3.What is the right answer for this tests?
Posted by DEVI LAL 3 Jan 2017 23:51
answer is very big it cannot be stored in 64 bits ,  U need to find another way.