Advertisement
Emiliatan

e169

May 28th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. /* e169            */
  2. /* AC (6ms, 104KB) */
  3. #include <cstdio>
  4. #include <cstring>
  5.  
  6. using namespace std;
  7.  
  8. const int mod = 100;
  9. int n, p, cnt[100]{}, ans;
  10.  
  11. int main()
  12. {
  13.     while(~scanf("%d", &n) && n)
  14.     {
  15.         ans = 0;
  16.         while(n-- && scanf("%d", &p))
  17.             ++cnt[p % mod];
  18.  
  19.         ans += (cnt[0] * (cnt[0] - 1) >> 1) + (cnt[50] * (cnt[50] - 1) >> 1);
  20.  
  21.         cnt[0] = cnt[50] = 0;
  22.         for(int i = 1; i < 50; ++i)
  23.             ans += cnt[i] * cnt[100 - i], cnt[i] = cnt[100 - i] = 0;
  24.  
  25.         printf("%d\n", ans);
  26.  
  27.         memset(cnt, 0, sizeof(int) * 100);
  28.     }
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement