forked from manwar/perlweeklychallenge-club
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ch-1.p
32 lines (27 loc) · 919 Bytes
/
ch-1.p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Program XXX;
(* *)
(* See https://theweeklychallenge.org/blog/perl-weekly-challenge-150 *)
(* *)
(* *)
(* Run as: fpc -och-1.out ch-1.p; ./ch-1.out < input-file *)
(* *)
uses
StrUtils, types;
var
line: string;
fibs: TStringDynArray;
fib_tmp, fib_prev, fib_last: string;
begin
while not eof do begin
readln (line);
fibs := SplitString (line, ' ');
fib_prev := fibs [0];
fib_last := fibs [1];
while length (fib_last) < 51 do begin
fib_tmp := fib_last;
fib_last := concat (fib_prev, fib_last);
fib_prev := fib_tmp;
end;
writeln (fib_last [51]);
end
end.