fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. long long d[16];
  4. int main()
  5. {
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(0);
  8. if (fopen("cpair11.inp", "r"))
  9. {
  10. freopen("cpair11.inp", "r", stdin);
  11. freopen("cpair11.out", "w", stdout);
  12. }
  13. int n;
  14. cin >> n;
  15. for (int i=1; i<=n; i++)
  16. {
  17. int a;
  18. cin >> a;
  19. d[(a*a)%11]++;
  20. }
  21. cout << d[0]*(d[0]-1)/2+d[1]*(d[1]-1)/2+d[3]*(d[3]-1)/2+d[4]*(d[4]-1)/2+d[5]*(d[5]-1)/2+d[9]*(d[9]-1)/2;
  22. }
  23.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty