Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Страница 4 |
if u have wa 4 | 👑TIMOFEY👑 | 1036. Счастливые билеты | 23 авг 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
|
Too easy | andreyDagger | 1036. Счастливые билеты | 15 окт 2021 13:49 | 1 |
I think that this is too easy problem for 297 points of hardness |
boring string | Abid29 | 1036. Счастливые билеты | 18 фев 2021 01:27 | 1 |
it wasted my whole day using string. then i use array instead of boring string and accepted |
AC program test cases | lakerka | 1036. Счастливые билеты | 2 июн 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. Счастливые билеты | 10 ноя 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. Счастливые билеты | 25 авг 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. Счастливые билеты | 23 мар 2012 22:05 | 1 |
|
Страница 3 |
why my program gets WA at 2 | subtlebear | 1036. Счастливые билеты | 14 дек 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. Счастливые билеты | 9 ноя 2011 19:47 | 1 |
New tests were added. 146 authors lost AC after rejudge. |
I get WA#3.What is the right answer for this tests? | Enigma [UB of TUIT] | 1036. Счастливые билеты | 3 янв 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. |
some hints | SKYDOS [Vladimir SU] | 1036. Счастливые билеты | 19 апр 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. Счастливые билеты | 17 апр 2011 06:34 | 7 |
WA#1 sklyack 8 апр 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 апр 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 апр 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. Счастливые билеты | 6 янв 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 |
help, please! What's the reason of WA on the 5th test ? | Vladislav Ivanishin | 1036. Счастливые билеты | 28 июн 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) |
WHY WA on Test#12 ? I don't understand!! | litaoye | 1036. Счастливые билеты | 3 мар 2009 13:14 | 2 |
for test "50 500" my program answer is "854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321" test "50 450" my program answer is "3834688188199309756675466732967588185862422492337212276545580039517258085033387305291001857619600" So i think my program is right,Why got WA on Test#12? OK I got AC My HugeInt class has some bug! |
sum of digits! | Vlad | 1036. Счастливые билеты | 27 фев 2009 19:10 | 3 |
Does the sum of the digits of the ticket must be even? Yes, it's even and equals 2N. I think sum of digit equals to given sum, but count of digit is 2N, and yes, if sum first half of digits equal to second then this sum is even |
WA#7 (-) | Grigor Gevorgian | 1036. Счастливые билеты | 17 окт 2009 19:17 | 5 |
WA#7 (-) Grigor Gevorgian 9 янв 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. |
Why wa on test 11 | Bright | 1036. Счастливые билеты | 10 фев 2008 18:38 | 1 |
Now all tests are OK.Thanks. Edited by author 11.02.2008 07:48 |
Java BigInteger was helpful for me!!! | manishmmulani | 1036. Счастливые билеты | 1 янв 2008 00:29 | 1 |
|
Interesting Question | Neymanov Tural | 1036. Счастливые билеты | 17 авг 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. |