Advertisement
dancidenis

io-p9

Dec 14th, 2018
98
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.  
  4. int srt()
  5. {
  6.     int h1, h2, h3, h4, m1, m2, m3, m4, s1, s2, s3, s4, t1, t2, t3, t4, a=" ", b=" ", nr1, nr2, T1, T2, T3, T4, Td1, Td2, T, count=0;
  7.     scanf("%d\n", &nr1);
  8.     scanf("%d:%d:%d,%d   %d:%d:%d,%d\n", &h1, &m1, &s1, &t1, &h2, &m2, &s2, &t2); //first starting and ending time
  9.     scanf("%s", &a);
  10.     printf("\n");
  11.     count++;
  12.  
  13.     scanf("%d\n", &nr2);
  14.     scanf("%d:%d:%d,%d   %d:%d:%d,%d\n", &h3, &m3, &s3, &t3, &h4, &m4, &s4, &t4); //second starting and ending time
  15.     scanf("%s", &b);
  16.     printf("\n");
  17.     count++;
  18.  
  19.     T1=t1+s1*1000+m1*60000+h1*3600000; // in milisecunde
  20.     T2=t2+s2*1000+m2*60000+h2*3600000;
  21.     T3=t3+s3*1000+m3*60000+h3*3600000;
  22.     T4=t4+s4*1000+m4*60000+h4*3600000;
  23.     Td1=T2-T1; //first displaying time
  24.     Td2=T4-T3; //second displaying time
  25.     T=Td1+Td2; //total displaying time
  26.     printf("%d\n", count); //the number of subtitle groups
  27.     printf("%02d:%02d:%02d,%03d\n", T/3600000, (T%3600000)/60000, (T%60000)/1000, (T%60000)%1000);
  28. }
  29.  
  30. int main()
  31. {
  32.     srt();
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement