ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1537. Ents

Damn, Always WA#15 (-)
Posted by AlMag 3 Mar 2007 13:38
WA15 too. May be something wrong?
Posted by Victor Barinov (TNU) 3 Mar 2007 13:47
Re: WA15 too. May be something wrong?
Posted by Victor Barinov (TNU) 3 Mar 2007 14:03
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?
Posted by Index Tree 3 Mar 2007 14:22
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?
Posted by Last_Vikings 3 Mar 2007 15:38
Thank You. WE GOT AC!!!
Re: WA15 too. May be something wrong?
Posted by Chernov Andrey [Vladimir SU] 3 Mar 2007 15:39
Thanks, AlMag!
Re: WA15 too. May be something wrong?
Posted by Narek Saribekyan 3 Mar 2007 15:42
Sorry

Edited by author 03.03.2007 15:44
Re: WA15 too. May be something wrong?
Posted by Narek Saribekyan 3 Mar 2007 15:46
Thanks to AlMag
Re: WA15 too. May be something wrong?
Posted by Piratek-(akaDK) 24 Jul 2007 21:52
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?
Posted by Borisov Oleg 28 Oct 2007 14:19
a[2] := 1 mod K;