Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <map>
  4. #include<string>
  5. #include<iomanip>
  6.  
  7. using namespace std;
  8.  
  9.  
  10. int main()
  11. {
  12. int n, amount;
  13. cin >> n;
  14. string name1, name2;
  15. map <string, int> clients;
  16.  
  17. for (int i = 0; i < n; i++)
  18. {
  19. cin >> name1 >> name2 >> amount;
  20. clients[name1] -= amount;
  21. clients[name2] += amount;
  22. }
  23.  
  24. map <string, int>::iterator cur;
  25.  
  26.  
  27. for (cur = clients.begin(); cur != clients.end(); cur++)
  28. {
  29. cout<< (*cur).first << " " << (*cur).second << endl;
  30. }
  31.  
  32.  
  33. system("pause");
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement