Advertisement
dancidenis

io-p8

Dec 14th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.05 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int fintimes()
  4. {
  5.     int h1, h2, h3, m1, m2, m3, s1, s2, s3, T1,T2, T3, winH, winM, winS, winT, r, secT;
  6.     r=scanf("%d:%d:%d", &h1, &m1, &s1);
  7.     scanf("%d:%d:%d", &h2, &m2, &s2);
  8.     scanf("%d:%d:%d", &h3, &m3, &s3);
  9.     winT=h1*3600+m1*60+s1;
  10.     secT=h2*3600+m2*60+s2;
  11.  
  12.     while(r==3)
  13.     {
  14.         printf("%d:%d:%d\n", h1, m1, s1); //print the winning time
  15.         T1=h2*3600+m2*60+s2;
  16.         T1=T1-winT;
  17.         printf("+%d:%02d:%02d   ", T1/3600, (T1%3600)/60, T1%60); //difference with respect to the previous time
  18.         printf("%d:%02d:%02d\n", T1/3600, (T1%3600)/60, T1%60); //difference with respect to the winning time
  19.  
  20.  
  21.         T2=h3*3600+m3*60+s3;
  22.         T2=T2-secT;
  23.         printf("+%d:%02d:%02d   ", T2/3600, (T2%3600)/60, T2%60); //difference with respect to the previous time
  24.         T3=h3*3600+m3*60+s3;
  25.         T3=T3-winT;
  26.         printf("%d:%02d:%02d", T3/3600, (T3%3600)/60, T3%60); //difference with respect to the winning time
  27.         break;
  28.     }
  29. }
  30.  
  31. int main()
  32. {
  33.     fintimes();
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement