From 2f674dc80f0382f1c3178f435714960734dc9d3c Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sat, 6 Jun 2020 21:33:13 +0700 Subject: Reorganize stuff from secondary school --- "2ndary/12/TP-ThanhHo\303\241-2009/bai2.pas" | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 "2ndary/12/TP-ThanhHo\303\241-2009/bai2.pas" (limited to '2ndary/12/TP-ThanhHoá-2009/bai2.pas') diff --git "a/2ndary/12/TP-ThanhHo\303\241-2009/bai2.pas" "b/2ndary/12/TP-ThanhHo\303\241-2009/bai2.pas" new file mode 100644 index 0000000..5b43c06 --- /dev/null +++ "b/2ndary/12/TP-ThanhHo\303\241-2009/bai2.pas" @@ -0,0 +1,41 @@ +var + n: word; + k, a: smallint; + f: text; + b: array[-999..999] of byte; + + +function libai2(): byte; + var + i: smallint; + + begin + for i := -999 to k - 1 do + if (b[i] > 0) and + (b[k * 2 - i] > 0) then + exit(1); + + if b[k] > 1 then + exit(1); + + exit(0) + end; + + +begin + assign(f, 'BAI2.INP'); + reset(f); + readln(f, n, k); + fillchar(b, sizeof(b), 0); + repeat + read(f, a); + inc(b[a]); + dec(n) + until n = 0; + close(f); + + assign(f, 'BAI2.OUT'); + rewrite(f); + writeln(f, libai2()); + close(f) +end. -- cgit 1.4.1