diff options
author | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-10-14 20:59:08 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-10-14 20:59:08 +0700 |
commit | cacc165173d67fa110766a555afe3020967d220c (patch) | |
tree | a859612503a5c4f4d870c074cc19d07b1eb3aed2 /codechef/msv.cc | |
parent | 4b8df7227736b7c41af56e053d40decc309fe7f9 (diff) | |
download | cp-cacc165173d67fa110766a555afe3020967d220c.tar.gz |
Practice some C++
Diffstat (limited to 'codechef/msv.cc')
-rw-r--r-- | codechef/msv.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/codechef/msv.cc b/codechef/msv.cc new file mode 100644 index 0000000..6206cff --- /dev/null +++ b/codechef/msv.cc @@ -0,0 +1,39 @@ +#include <algorithm> +#include <iostream> +#include <unordered_map> + +using namespace std; + +int +main() +{ + int t, n, i; + long a; + + cin >> t; + while (t--) + { + int star = 0; + unordered_map<long, int> m; + + cin >> n; + while (n--) + { + cin >> a; + star = max (m[a], star); + + for (i = 1; i * i < a; ++i) + if (a % i == 0) + { + m[i]++; + m[a / i]++; + } + if (i * i == a) + m[i]++; + } + + cout << star << endl; + } + + return 0; +} |