Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <sstream>
- #include <utility>
- #include <vector>
- #include <algorithm>
- int main()
- {
- int x, y, num;
- std::string input;
- std::string command;
- getline(std::cin, input, '#');
- std::cin >> num;
- std::stringstream ss(input);
- std::vector<std::pair<int, int>> data;
- while (!ss.eof()) {
- ss >> command >> x >> y;
- if (ss.fail()) {
- ss.clear();
- break;
- }
- for (int i = 1; i < num + 1; i++)
- {
- data.emplace_back(i*y, x);
- }
- }
- std::sort(data.begin(), data.end());
- for (int i = 0; i < num; i++)
- {
- //std::cout << data[i].first << ", " << data[i].second << std::endl;
- std::cout << data[i].second << std::endl;
- }
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement