1class Solution {2public:3vector<int> powerfulIntegers(int x, int y, int bound) {4unordered_set<int> s;56for (int i = 0; pow(x, i) <= bound; i++) {7for (int j = 0; pow(x, i) + pow(y, j) <= bound; j++) {8s.insert(pow(x, i) + pow(y, j));9if (y == 1) break;10}11if (x == 1) break;12}13return vector<int>(s.begin(), s.end());14}15};