Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <map>
- #include<string>
- #include<iomanip>
- using namespace std;
- int main()
- {
- int n, amount;
- cin >> n;
- string name1, name2;
- map <string, int> clients;
- for (int i = 0; i < n; i++)
- {
- cin >> name1 >> name2 >> amount;
- clients[name1] -= amount;
- clients[name2] += amount;
- }
- map <string, int>::iterator cur;
- for (cur = clients.begin(); cur != clients.end(); cur++)
- {
- cout<< (*cur).first << " " << (*cur).second << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement