SRM 716 DIV II

class Permutiple {
public:
string isPossible(int x) {
string xx = std::to_string(x);
do {
int val = std::stoi(xx);
if (val <= x) continue;
if (val % x == 0) return "Possible";
} while (std::next_permutation(xx.begin(), xx.end()));
return "Impossible";
}
}

class ConstructLCSEasy {
public:
string construct(int ab, int bc, int ca) {
string AB(ab, '1');
string BC = AB, CA = AB;
int diff2 = bc - ab;
while (diff2--) {
BC += "0"; CA += "0";
}
int diff3 = ca - ab;
while (diff3--) {
AB += "1"; CA += "1";
}
return AB + " " + BC + " " + CA;
}
}