|
|
back to boardDiscussion of Problem 1537. EntsDamn, Always WA#15 (-) Posted by AlMag 3 Mar 2007 13:38 WA15 too. May be something wrong? Re: WA15 too. May be something wrong? Try test 1 1 Re: WA15 too. May be something wrong? Posted by AlMag 3 Mar 2007 14:19 0 true? Re: WA15 too. May be something wrong? I also get 0. But WA15 Edited by author 03.03.2007 14:22 Edited by author 03.03.2007 14:22 Edited by author 03.03.2007 14:22 Re: WA15 too. May be something wrong? Posted by AlMag 3 Mar 2007 14:26 YES!!!!!!! Try this test 2 1 ))))) Re: WA15 too. May be something wrong? Thank You. WE GOT AC!!! Re: WA15 too. May be something wrong? Thanks, AlMag! Re: WA15 too. May be something wrong? Sorry Edited by author 03.03.2007 15:44 Re: WA15 too. May be something wrong? Thanks to AlMag Re: WA15 too. May be something wrong? Why Wa 15 {$Apptype console} Const Find = 12344321; Type Longint = int64; Var a , b : array [1..10000000] of longint; N , k : longint; Function Ans(x : longint):longint; begin if b[x] = Find then begin Ans := a[x]; exit; end; b[x] := Find; if odd(x) then a[x] := Ans(x - 1) else a[x] := (Ans(x div 2) + Ans(x - 1)) mod k; Ans := a[x]; end; Begin Read(N , K); // if k = 1 then k := Trunc(1e14); b[2] := Find; a[2] := 1; if n < 2 then write(0) else Write(Ans(N)); readln; readln; end. Re: WA15 too. May be something wrong? a[2] := 1 mod K; |
|
|