fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Main
  9. {
  10. public static void main (String[] args)
  11. {
  12. Scanner scanner = new Scanner(System.in);
  13.  
  14. int H, M;
  15.  
  16. H = scanner.nextInt();
  17. M = scanner.nextInt();
  18.  
  19. if (M - 45 < 0) {
  20. if (H == 0) H = 23;
  21. else H--;
  22. M += 15;
  23. }
  24. else M -= 45;
  25.  
  26. System.out.println("" + H + " " + M);
  27. }
  28. }
Success #stdin #stdout 0.19s 37780KB
stdin
0 20
stdout
23 35