Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <map>
- int main()
- {
- using namespace std;
- size_t n;
- cin >> n;
- map<string, double> data;
- for (;data.size() < n;) //while(data.size() < n)
- {
- string city;
- double price, quantity;
- cin >> city >> price >> quantity;
- data[city] += price * quantity;
- }
- for (const auto& c : data)
- cout << c.first << ' ' << c.second << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment