fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int sh, sm;
  6. int fh, fm;
  7. scanf("%d:%d", &sh, &sm);
  8. scanf("%d:%d", &fh, &fm);
  9. int start = sh*60+sm;
  10. int finish = fh*60+fm;
  11. int way, rest;
  12. scanf("%d %d", &(way), &(rest));
  13. int x = way + rest;
  14. for(int t=start, i=0; t<finish; t+=x, i++){
  15. printf("%02d:%02d %s", t/60, t%60, i% 2 == 0? "\t":"\n");
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 3464KB
stdin
6:00 23:00 120 15
8:00 24:00 30 10
stdout
06:00 	08:15 
10:30 	12:45 
15:00 	17:15 
19:30 	21:45