From 2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0 Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Sat, 8 Oct 2016 09:56:43 +0700 Subject: Initial commit --- 10/CSP-KT2/dcount.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 10/CSP-KT2/dcount.c (limited to '10/CSP-KT2/dcount.c') diff --git a/10/CSP-KT2/dcount.c b/10/CSP-KT2/dcount.c new file mode 100644 index 0000000..e851210 --- /dev/null +++ b/10/CSP-KT2/dcount.c @@ -0,0 +1,27 @@ +#include + +/* More than 8MB is used by this program, for *efficiency*. */ + +int main() +{ + long n, i, a0, m = 0, max = 0; + long a[100001] = {}, b[100001]; + + scanf("%ld", &n); + for (i = 0; i < n; i++) { + scanf("%ld", &a0); + if (!a[a0]) { + b[m] = a0; + m++; + } + a[a0]++; + } + + for (i = 0; i < m; i++) + if (a[b[i]] > max) + max = a[b[i]]; + + printf("%ld %ld\n", m, max); + + return 0; +} -- cgit 1.4.1