/* -*- coding: utf-8 -*- * * 825.cc: No.825 賢いお買い物 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ /* typedef */ /* global variables */ /* subroutines */ /* main */ int main() { int a, b, c; scanf("%d%d%d", &a, &b, &c); int maxp = a + 10 * b; for (int p = 1; p <= maxp; p++) for (int u = 0; u <= a; u++) for (int t = 0; t <= b; t++) { int q = u + 10 * t; if (q >= p) { int g = q - p; int a0 = a - u + g % 10; int b0 = b - t + g / 10; if (a0 + b0 == c) { printf("%d\n", p); return 0; } } } puts("Impossible"); return 0; }