diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
commit | 2f674dc80f0382f1c3178f435714960734dc9d3c (patch) | |
tree | 2abba7e4ec72bd16f58f7375126144d3fd9f4bca /2ndary/12/TP-ThanhHoá-2009/bai2.pas | |
parent | b2d80610db6beda38573890ed169815e495bc663 (diff) | |
download | cp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz |
Reorganize stuff from secondary school
Diffstat (limited to '2ndary/12/TP-ThanhHoá-2009/bai2.pas')
-rw-r--r-- | 2ndary/12/TP-ThanhHoá-2009/bai2.pas | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/2ndary/12/TP-ThanhHoá-2009/bai2.pas b/2ndary/12/TP-ThanhHoá-2009/bai2.pas new file mode 100644 index 0000000..5b43c06 --- /dev/null +++ b/2ndary/12/TP-ThanhHoá-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. |