Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int cnt[128];
  4. int divisors(int n)
  5. {
  6. for (int i=1; i<=sqrt(n); i++)
  7. {
  8. if (n%i==0)
  9. {
  10. if (n/i == i)
  11. cnt[i]++;
  12. else
  13. {
  14. cnt[n/i]++;
  15. }
  16. }
  17. }
  18. }
  19. int main()
  20. {
  21. int t;
  22. cin>>t;
  23. while(t--)
  24. {
  25. memset(cnt,0,sizeof(cnt));
  26. int n;
  27. cin>>n;
  28. int maxx=0;
  29. for(int i=0; i<n; i++)
  30. {
  31. int m;
  32. cin>>m;
  33. maxx=max(maxx,cnt[m]);
  34. divisors(m);
  35. }
  36. cout<<maxx<<endl;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement