Advertisement
GerONSo

Untitled

Sep 18th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. int n;
  2. n = readInt();
  3. vi a(n);
  4. for(int i = 0; i < n; i++) {
  5. a[i] = readInt();
  6. }
  7. map<int, int> mp;
  8. for(int i = 0; i < n; i++) {
  9. for(int j = 0; j < i; j++) {
  10. mp[a[i] + a[j]]++;
  11. }
  12. }
  13. for(int i = 0; i < n; i++) {
  14. writeInt(mp[a[i]]);
  15. writeChar('\n');
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement