fork download
  1. import java.util.*;
  2.  
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7.  
  8. Scanner sc=new Scanner(System.in);
  9. int a=sc.nextInt(); //시
  10. int b=sc.nextInt(); //분
  11.  
  12. int h_sec=3600;
  13. int m_sec=60;
  14.  
  15. int a_sec= a==0? 24*h_sec : a*h_sec;
  16. int b_sec= b*m_sec;
  17.  
  18. int sum_sec=(a_sec+b_sec)-2700;
  19.  
  20. int printH = sum_sec / h_sec;
  21. if(printH==0){
  22. printH=23;
  23. }
  24. int printM = (sum_sec % h_sec)/m_sec;
  25.  
  26.  
  27. System.out.println(printH+" "+printM);
  28.  
  29. //System.out.println(2700 / 60);
  30.  
  31. //1시간은 3600초 + 2700초
  32. //2시간 45분의 45분전
  33.  
  34. //1시간은 60분, 1분은 60초
  35. //5분은 300초
  36. //10분은 600초
  37. //40분은 2400초
  38. //45분은 2700초
  39.  
  40.  
  41. }
  42. }
Success #stdin #stdout 0.2s 53652KB
stdin
0 45
stdout
24 0