fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class A
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. int n;
  11. while (in.hasNextInt()) {
  12. n = in.nextInt();
  13. int[] seg = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  14. for (int i = 0; i < 24; i++)
  15. for (int j = 0; j < 60; j++) {
  16. int a = 0;
  17. a = a + seg[i / 10];
  18. a = a + seg[i % 10];
  19. a = a + seg[j / 10];
  20. a = a + seg[j % 10];
  21. if (a == n) {
  22. if (i < 10) System.out.printf("0%d", i);
  23. else System.out.print(i);
  24. System.out.print(":");
  25. if (j < 10) System.out.printf("0%d", j);
  26. else System.out.print(j);
  27. return;
  28. }
  29. }
  30. System.out.print("Impossible");
  31. }
  32. in.close();
  33. return;
  34. }
  35. }
Success #stdin #stdout 0.07s 2184192KB
stdin
15	
stdout
01:12