fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int H, M;
  6.  
  7. scanf("%d %d", &H, &M);
  8.  
  9. if (H < 0 || H > 23 || M < 0 || M > 60)
  10. {
  11. printf("시간이 정확하지 않습니다 다시 입력해주십시오");
  12. return -1;
  13. }
  14.  
  15. M = M - 45;
  16.  
  17. if (H == 0)
  18. {
  19. if (M <= 0)
  20. {
  21. H = 23;
  22. M = 60 + M;
  23. }
  24. }
  25. else
  26. {
  27. if (M <= 0)
  28. {
  29. H -= 1;
  30. M = 60 + M;
  31. }
  32. }
  33.  
  34. printf("%d %d", H, M);
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0s 5016KB
stdin
0 45
stdout
23 60