Pagini recente » Cod sursa (job #3173322) | Cod sursa (job #2976325) | Cod sursa (job #377371) | Cod sursa (job #1273861) | Cod sursa (job #156888)
Cod sursa(job #156888)
var f,g:text;
n,i,t,c1,c2,c,l1,l2,j:longint;
s1,s2,s:string;
begin
assign(f,'nunta.in');
assign(g,'nunta.out');
reset(f);
rewrite(g);
read(f,n);
s1:='1';
s2:='2';
s:='';
for i:=3 to n do
begin
t:=0;
l1:=length(s1);
l2:=length(s2);
for j:=1 to l1 do
begin
c1:=ord(s1[j])-48;
c2:=ord(s2[j])-48;
c:=(c1+c2+t) mod 10;
t:=(c1+c2+t) div 10;
s:=s+chr(c+48);
end;
if l2>l1 then
begin
c2:=ord(s2[l2])-48;
c:=t+c2;
s:=s+chr(c+48);
end;
if (l1=l2) and (t>0) then
begin
s:=s+chr(t+48);
end;
s1:=s2;
s2:=s;
s:='';
end;
if n<4 then write(g,n) else
for i:=length(s2) downto 1 do
write(g,s2[i]);
close(f);
close(g);
end.