fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int A,B,C,D, th, tm;
  5.  
  6. scanf("%d%d%d%d", &A, &B, &C,&D);
  7.  
  8. if(A > C){
  9. if (B < D){
  10. th = (A - 24) + C;
  11. tm = (D - B);
  12. }
  13. if (B > D){
  14. th = (A - 24) + C;
  15. tm = (B - D) - 60;
  16. tm *= -1;
  17. }
  18. if (B == D){
  19. th = (A - 24) + C;
  20. tm = (D - B);
  21. }
  22. }
  23.  
  24.  
  25. if(A < C){
  26.  
  27. if (B < D){
  28. th = C - A;
  29. tm = (D - B);
  30. }
  31. if (B > D){
  32. th = C - A - 1;
  33. tm = (B - D) - 60;
  34. tm *= -1;
  35. }
  36. if (B == D){
  37. th = C - A;
  38. tm = (D - B);
  39. }
  40. }
  41. if(A == C){
  42.  
  43. if(B == D){
  44. th = 24;
  45. tm = 0;
  46. }
  47. if(B < D){
  48.  
  49. th = A - C;
  50. tm = D - B;
  51.  
  52. }
  53. }
  54.  
  55. printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", th, tm);
  56.  
  57. return 0;
  58. }
Success #stdin #stdout 0s 9432KB
stdin
22 10 9 22
stdout
O JOGO DUROU 7 HORA(S) E 12 MINUTO(S)