TEMA
Accepted Code
sanjoy.paul preguntado 3 years ago
Think if the difference between (m-n) is possible to change only two notes. Otherwise impossible.
int n, m, B[] = {2, 5, 10, 20, 50, 100}; while (scanf("%d %d", &n, &m)) { if (n == 0 && m == 0) return; int rem = m - n; bool ok = false; for (int i = 0; i < 5; i++) { for (int j = i + 1; j < 6; j++) { if (B[i] + B[j] == rem) { ok = true; true; } } } if (ok) printf("possible\n"); else printf("impossible\n"); }
Este tema aún no ha sido contestado. ¡Sé el primero!