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 1012. K-based Numbers. Version 2

please look
Posted by zzzlll 3 Jan 2007 22:01
why in here wrong answer in 6
var
c:array[0..50] of integer;
n,m,i ,fn:longint;
begin
readln(n,m);
c[0]:=1;
c[1]:=m-1;
for i:=2 to n do
c[i]:=(m-1)*(c[i-1]+c[i-2]);
writeln(c[n]);
end.
Re: please look
Posted by Slam [Tartu U] 3 Jan 2007 22:10
longint is not enough
whow
Posted by zzzlll 3 Jan 2007 22:13
but how  i can do array with extended???
please look giving wrong answer in 6
Posted by zzzlll 3 Jan 2007 22:20
var
c:array[0..180] of real;
n,m,i ,fn:longint;
begin
readln(n,m);
c[0]:=1;
c[1]:=m-1;
i:=1;
repeat
i:=i+1;
{for i:=2 to n do   }
c[i]:=(m-1)*(c[i-1]+c[i-2]);
until i>=n;
writeln(c[n]:0:0);
end.
Re: please look
Posted by ☞ⓩⓢⓨⓩ™ⓣⓔⓢⓣ☜ 22 Mar 2009 12:31
竟让可以打中文??!!》》》》》》》
Re: please look
Posted by zsyzhbc_china 22 Mar 2009 12:40
滚一边玩去