From b7e55e6510690093d61f9cc1152e0330e55fe90b Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Tue, 28 Feb 2017 11:34:35 +0700 Subject: Update others/volume1 --- others/volume1/124.pas | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 others/volume1/124.pas (limited to 'others/volume1/124.pas') diff --git a/others/volume1/124.pas b/others/volume1/124.pas new file mode 100644 index 0000000..6a41c8e --- /dev/null +++ b/others/volume1/124.pas @@ -0,0 +1,28 @@ +uses clib; + +var + m, n, i, k: int8; + a: intar; + s: array of array of ansistring; + +begin + readln(n, k); + setlength(a, n); + for i := 0 to n - 1 do + read(a[i]); + qsort(a); + m := 1; + for i := 1 to n - 1 do + if a[i] > a[i - 1] then + inc(m); + setlength(s, m); + for n := 0 to m - 1 do + begin + setlength(s[n], n + 2); + s[n][0] := '1'; + for i := 1 to n do + s[n][i] := addintstr(s[n - 1][i], s[n - 1][i - 1]); + s[n][n + 1] := '0' + end; + writeln(addintstr(s[m - 1][k], s[m - 1][k - 1])) +end. -- cgit 1.4.1