fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6. Scanner sc = new Scanner(System.in);
  7.  
  8. int H = sc.nextInt();
  9. int M = sc.nextInt();
  10. sc.close();
  11.  
  12. int time = H*60+M-45;
  13.  
  14. if(H==0) {
  15. time = 24*60+M-45;
  16. System.out.println(23+" "+(time%60));
  17. }else if(H>0 && H<=23){
  18.  
  19. System.out.println(time/60+" "+time%60);
  20. }
  21.  
  22. }
  23.  
  24. }
Success #stdin #stdout 0.18s 36180KB
stdin
0 45
stdout
23 0