From 1a8e1e68759611a66ae116771da5f376c95a3b9f Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Sun, 12 Feb 2017 16:18:20 +0700 Subject: Update others/volume1 --- others/volume1/035.pas | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 others/volume1/035.pas (limited to 'others/volume1/035.pas') diff --git a/others/volume1/035.pas b/others/volume1/035.pas new file mode 100644 index 0000000..ccf9560 --- /dev/null +++ b/others/volume1/035.pas @@ -0,0 +1,29 @@ +var + n, a: int16; + b: array of boolean; + +function all(b: array of boolean): boolean; + var + i: int16; + begin + for i := 0 to length(b) - 1 do + if not b[i] then + exit(false); + all := true + end; + +begin + readln(n); + setlength(b, n); + for n := n - 1 downto 0 do + b[n] := false; + for n := 1 to length(b) do + begin + read(a); + if (a <= 0) or + (a > length(b)) then + continue; + b[a - 1] := true + end; + writeln(all(b)) +end. -- cgit 1.4.1