Show all threads Hide all threads Show all messages Hide all messages |
if u have wa 4 | 👑TIMOFEY👑 | 1036. Lucky Tickets | 23 Aug 2022 11:22 | 1 |
wa4 have test n=1 and some m if u use dp and u write in your massive some int, when u write, u delete int and create new ints. But if u have n=1, u now answer for every for n=1 and when u use dp its write 0, it enters zero instead of the answer you wrote down, although there should be one in some cells
|
Crash on 3 test | Koshmarik | 1036. Lucky Tickets | 22 Jun 2022 08:43 | 5 |
Have anybody crash on 3 test? It's interesting, that my friend decided this problem and on tests with n>50 we have the same answer. I had. You must add in your programm something like this: if(sum/9>2*n){ printf("0"); return 0; } thanks. I just found my forgotten! my program cannot print 0 'zero' ( - -") Why is this condition required? The recursive formula takes care of this.. Without this condition my code gets WA3.. And when I add it, it gets AC.. Could you plz give a test case where this condition is really required, where the DP formula fails..?? I don't think it's DP formula's fault Perhaps when you are deleting leading zero, you haven't judge if the point is >= 0 |
Too easy | andreyDagger | 1036. Lucky Tickets | 15 Oct 2021 13:49 | 1 |
I think that this is too easy problem for 297 points of hardness |
boring string | Abid29 | 1036. Lucky Tickets | 18 Feb 2021 01:27 | 1 |
it wasted my whole day using string. then i use array instead of boring string and accepted |
What's wrong with my Test 2? | Garin | 1036. Lucky Tickets | 23 May 2020 10:15 | 6 |
I can get the right answer of 50 500,but I can't AC the second test..What's up? What's the data? Maybe for test 2 3 answer 0 thanks very much for your advice Than you: for test 2 3 answer 0 > test 2 3 This test is not correct cause S must be even. Update: Sorry, S can be odd! And yes, this is the second test case. Edited by author 23.05.2020 10:20 Edited by author 23.05.2020 10:20 Edited by author 28.09.2007 16:34 |
HINT! | Yegor Suvorov | 1036. Lucky Tickets | 26 Jun 2018 11:29 | 13 |
HINT! Yegor Suvorov 20 May 2007 15:45 Answers for big tests is very big. For example, for test "50 500" answer is "854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321". Don't use long long or int64! Use long numbers (long arithmetic)! (Длинная арифметика) I dont have idea. Who can explain to me, how to solve this problem? thx a lot. Thank you for your hint,though I know to use long arithmetic(my arithmetic is wrong). I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. The "HINT!" from Yegor Suvorov is correst, so yours is not. Re: HINT! unlucky [Vologda SPU] 8 Feb 2010 01:16 Thanks!!!:) Edited by author 19.11.2010 11:14 Edited by author 28.10.2015 19:11 Yes, I think so! I think the answer for the test"50 500" is "2691417369747203226859471552248904568444092968464995017156586373422740263569136967872156335261820969253753890314496",does anybody get the same answer as me? WAITING FOR HELP. no! the answer is "854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321" Edited by author 03.01.2017 23:05 hints :- 50 500 854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321 ( this ans is correct ) make sure value of each digit must not exceed 9 |
I get WA#3.What is the right answer for this tests? | Enigma [UB of TUIT] | 1036. Lucky Tickets | 3 Jan 2017 23:51 | 5 |
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 :) 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. 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. Edited by moderator 12.01.2022 16:54 answer is very big it cannot be stored in 64 bits , U need to find another way. |
AC program test cases | lakerka | 1036. Lucky Tickets | 2 Jun 2014 19:58 | 1 |
10 0 1 2 1 0 30 95 0 3 4 36 3 6 100 10 30 1657615050256 15 30 5988336077235600 20 100 475696100826892995150152084506564 50 300 3660144008320861404705392514284143308670326732628084621145897204106027006076468826991924409 |
A question regarding the question..... | Jaideva | 1036. Lucky Tickets | 10 Nov 2013 01:06 | 1 |
The value of N is <= 50, so we are talking about a 100 digit number atmost.....how then the upper limit of S is 1000.....shouldn't it be 900.....or are we supposed to return 0 when (2*N*9) < S. Am I missing something ????? Edited by author 10.11.2013 01:07 Nevermind.....I solved it..... Few useful insights :- (i) if S > (2*9*N) output 0; (ii) if S = 0 output 1; (otherwise you would get WA for test 5). Edited by author 10.11.2013 02:27 |
SomeTest | Anna | 1036. Lucky Tickets | 25 Aug 2012 16:36 | 1 |
The correct answer for test 3 4 is 36. May be it will help someone |
In the case 7, is it case of big number??? | bunkung | 1036. Lucky Tickets | 23 Mar 2012 22:05 | 1 |
|
why my program gets WA at 2 | subtlebear | 1036. Lucky Tickets | 14 Dec 2011 03:54 | 2 |
Please help me, i don't understand what is wrong with the code below import java.math.BigInteger; import java.io.*; import java.util.*; public class LuckyTickets { public static void main(String[] args) {
int N,S; BigInteger F[][] = new BigInteger[51][];
for(int i = 0; i <= 50; i++) F[i]= new BigInteger[1001];
Scanner scanner= new Scanner(System.in); try { N= scanner.nextInt(); S= scanner.nextInt();
for(int j= 0; j <= N; j++) for(int i= 0; i <= S; i++) F[j][i]= new BigInteger("0");
for(int j= 1; j <= N; j++) F[j][0] = BigInteger.ONE;
for(int i= 1; i < 10; i++) F[1][i] = BigInteger.ONE;
for(int i= 2; i <= N; i++) for(int k= 1; k <= S; k++) { for(int j= 0; j <= 9 && j <= k; j++) F[i][k]= F[i][k].add(F[i-1][k-j]); } // there are F[N][S/2] * F[N][S/2] different tickets System.out.println(F[N][S/2].multiply(F[N][S/2]));
// for(int j= 0; j <= N; j++){ // for(int i= 0; i <= S; i++) // System.out.print(F[j][i]+ " "); // System.out.println(""); // }
} catch(InputMismatchException e) { System.out.println("Mismatch exception " + e); }
} } you don't need 2-dimension F[][], just only using one-dimension BigInteger array (in your case, F[]) is enough. for(int j= 0; j <= 9 && j <= k; j++) change this to for(int j= 1; j <= 9 && j <= k; j++) check answer '0' at the begining for two cases: S is odd or S > 18 * n second dimension of F is [s + 1] instead of 1001 which kills memory.. I got accepted using Java biginteger as well, and I create the array of below: BigInteger []f = new BigInteger[s + 1]; That is it! |
Problem 1036 "Lucky Tickets" has been rejudged (+) | Sandro (USU) | 1036. Lucky Tickets | 9 Nov 2011 19:47 | 1 |
New tests were added. 146 authors lost AC after rejudge. |
Can u give some hints... i thing there is a dynamic programming formula that i can't find. | Costel::icerapper@k.ro | 1036. Lucky Tickets | 4 Sep 2011 20:09 | 3 |
result[N][S] = result[N-1][S-i] (where i from 0 to 9 inclusive and S-i >=0) Edited by author 08.07.2010 15:25 I found equal formula and got WA8 (( |
some hints | SKYDOS [Vladimir SU] | 1036. Lucky Tickets | 19 Apr 2011 15:46 | 2 |
test 2: s%2!=0 so answer is 0 test 5: S is 0 so answer is 1 Good luck :) Thanks for test case 5, I used a < instead of a <= |
WA#1 | sklyack | 1036. Lucky Tickets | 17 Apr 2011 06:34 | 7 |
WA#1 sklyack 8 Apr 2010 05:41 My program works correctly on all tests from the forum: 50 500 --> 854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321 50 450 --> 3834688188199309756675466732967588185862422492337212276545580039517258085033387305291001857619600 10 2 --> 100 50 1000 --> 0 3 1 --> 0 50 250 --> 41409732703108026572448942476041207839411119408173570127621420289526490759097327483136 50 300 --> 3660144008320861404705392514284143308670326732628084621145897204106027006076468826991924409 5 10 --> 15876 50 896 --> 1625625 10 10 --> 4008004 49 2 --> 2401 1 20 --> 0 50 0 --> 1 , but I got WA#1! I used DP and long arithm. What it can be caused by? Edited by author 08.04.2010 05:42 Edited by author 08.04.2010 05:43 Re: WA#1 dAFTc0d3r [Yaroslavl SU] 8 Apr 2010 21:19 Maybe the problem is in I/O? Do you mean problems with output? I tried this for(int i=A.N-1; i>=0; i--) cout<<A.A[i]; , this for(int i=A.N-1; i>=0; i--) printf("%d", A.A[i]-'0'); and this for(int i=A.N-1; i>=0; i--) printf("%c", A.A[i]); A.A -- array of char, my long number. My input: int N, S; cin>>N>>S; o_O i don't know if it's a problem but you probably want to check if S is odd then output is 0. something like 10 1 --> 0 and you know that if S > 9*2*n then output is also 0. Edited by author 10.04.2010 01:16 Yes, 10 1 --> 0, my program works correctly on this test. And for each odd S it outputs 0: it contains if(S%2) { cout<<0; return 0; } . And yes, if S > 9*2*n it outputs 0. For example 5 90 --> 1 5 91 --> 0 5 92 --> 0 40 720 --> 1 40 721 --> 0 40 722 --> 0 I almost sure in my solution, I really have no idea what wrong with the program, but I got WA. And the most strange that I got WA on the first test !!! Edited by author 10.04.2010 01:34 Edited by author 10.04.2010 01:36 Re: WA#1 Kovtun_Ruslan_(VNTU) 17 Apr 2011 06:34 ostream &operator <<(ostream &out, vector<int> a){ out << a.back(); FOR(i,0,a.size()-2) out << setfill('0') << setw(9) << a[i]; return out; } // main cout << vector<int>(1, 2356) << endl; Edited by author 17.04.2011 06:34 Edited by author 17.04.2011 06:34 |
Why my code WA#7>????? Need help?Who know the test for #7? | zslwyuan | 1036. Lucky Tickets | 6 Jan 2010 18:55 | 2 |
type sl=array[1..150] of longint; var i,j,k,l,n,m,s:longint; f:array[0..50,-10..1000] of sl; u:sl; function gjc(a:sl):sl; var i,t:longint; tmp:sl; begin for i:=120 downto 1 do if a[i]<>0 then break; t:=i; fillchar(tmp,sizeof(tmp),0); for i:=1 to t do for j:=1 to t do inc(tmp[i+j-1],a[i]*a[j]); for i:=1 downto 120 do begin tmp[i+1]:=tmp[i+1]+tmp[i] div 10000; tmp[i]:=tmp[i] mod 10000; end; exit(tmp); end; procedure gjj(b:sl;var a:sl); var i,j,k,l:longint; begin for i:=1 to 120 do a[i]:=a[i]+b[i]; for j:=1 to 120 do begin inc(a[j+1],a[j] div 10000); a[j]:=a[j] mod 10000; end; end; procedure printgj(a:sl); var i,j,k,l,len:longint; st:string; begin i:=120; while (i>0)and(a[i]=0) do dec(i); if i=0 then BEGIN writeln(0);exit;end; len:=i-1; write(a[len+1]); for i:=len-1 downto 1 do begin str(a[i],st); while length(st)<4 do insert('0',st,1); write(st); end; end; begin readln(n,s); if (n=1)and(s<=9) then begin writeln(1);halt; end; if s mod 2=1 then begin writeln(0);halt; end; f[0,0][1]:=1; for i:=1 to n do for j:=0 to s shr 1 do for k:=0 to 9 do begin gjj(f[i-1,j-k],f[i,j]); end; l:=s shr 1; u:=(gjc(f[n,l])); printgj(u); end. Edited by author 07.01.2010 10:17 |
WA#7 (-) | Grigor Gevorgian | 1036. Lucky Tickets | 17 Oct 2009 19:17 | 5 |
WA#7 (-) Grigor Gevorgian 9 Jan 2009 21:59 I use java BigInteger and get WA#7 I use formula f(n,k)=f(n-1,k)+f(n-1,k-1)+...+f(n-1,k-9) if you see it is wrong,please help Edited by author 25.01.2009 13:43 I use the same formula as you. and I get WA#7 too. Do you realize that the number of such tickets can be of the order of 10^N, that is an N-digit number, where N~50 of decimal digits? Edited by author 18.01.2009 03:51 Edited by author 18.01.2009 03:53 The formula is correct,just made a stupid bug: I wrote a[j][i]=a[j][i].add(a[j][l]) instead of a[j][i]=a[j][i].add(a[j][i-l]) :) Edited by author 25.01.2009 13:42 Edited by author 25.01.2009 13:42 I guess that the test 7 contains 50 900. The test 8 contains 50 450. |
Interesting Question | Neymanov Tural | 1036. Lucky Tickets | 17 Aug 2009 17:57 | 5 |
maybe it will be more interesting for me but....
...anyway, can't function be array, record, set in Pascal?
thanks. Edited by author 21.12.2007 13:28 But... You Can define A type for example: type rec=record x,y:Longint; end; function f(a:rec):rec; begin end. Is Right Really Interesting! Posted by LiuKe April 09, 2008 18:26 Posted by LiuKe November 20, 2008 21:01 You can't make function with such returning value as record or array in complier version Turbo Pascal 7.0. But Delphi allows us do such things. Compiler of this site (Free Pascal) allows us too. |
help, please! What's the reason of WA on the 5th test ? | Vladislav Ivanishin | 1036. Lucky Tickets | 28 Jun 2009 22:51 | 2 |
my program works correctly on all the tests from the forum... //I use long arithmetic and DP sorry = ) I've got it (There was problem when sum = 0) |