|
|
вернуться в форумWhy I get WA? Pelase, help me!!!!!!! my code: Program t1133; Type Fib=record i,Fi :longint end; Var a,b,c,p :fib; i,j,n :longint; l1,l2 :longint; n1,n2,cur :longint; p3,p2,p1 :longint; begin read(a.i,a.fi); read(b.i,b.fi); read(n); if a.i<b.i then begin c:=a; a:=b; b:=c; end; l1:=1; l2:=1; if a.i-b.i>1 then for i:=a.i-2 downto b.i+1 do begin n1:=l1+l2; n2:=l1; l1:=n1; l2:=n2; end; if a.i-b.i>1 then begin p.i:=b.i+1; p.fi:=(a.fi-l2*b.fi) div l1; end else p:=a; if p.i=n then cur:=p.fi else if b.i=n then cur:=b.fi else if a.i=n then cur:=a.fi else if p.i<n then begin p1:=b.fi; p2:=p.fi; for i:=p.i+1 to n do begin p3:=p2+p1; l1:=p2; p2:=p3; p1:=l1; end; cur:=p3; end else if b.i>n then begin p3:=p.fi; p2:=b.fi; for i:=b.i-1 downto n do begin p1:=p3-p2; l1:=p2; p2:=p1; p3:=l1; end; cur:=p1; end; writeln(cur); end. Re:I get AC!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! There is smaa...........aal bug in my program. But i don't say what. [code deleted] Edited by moderator 20.11.2019 23:18 |
|
|