fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int n;
  5.  
  6. while (cin >> n) {
  7. int seg[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  8. for (int i = 0; i < 24; i++)
  9. for (int j = 0; j < 60; j++) {
  10. int a = 0;
  11. a = a + seg[i / 10];
  12. a = a + seg[i % 10];
  13. a = a + seg[j / 10];
  14. a = a + seg[j % 10];
  15. if (a == n) {
  16. if (i < 10) cout << '0' << i;
  17. else cout << i;
  18. cout << ':';
  19. if (j < 10) cout << '0' << j;
  20. else cout << j;
  21. return 0;
  22. }
  23. }
  24. cout << "Impossible";
  25. }
  26. }
Success #stdin #stdout 0s 4516KB
stdin
23
stdout
00:02