fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int h1,m1,h2,m2;
  6. while(cin>>h1>>m1>>h2>>m2){
  7. if(h1==0 and m1==0 and h2==0 and m2==0){
  8. break;
  9. }
  10. int t1=h1*60+m1;
  11. int t2=h2*60+m2;
  12. int ans=t2-t1;
  13. if(t2-t1<0){
  14. ans=ans+1440;
  15. }
  16. cout<<ans<<endl;
  17. }
  18. }
Success #stdin #stdout 0.01s 5288KB
stdin
1 5 3 5
23 59 0 34
21 33 21 10
0 0 0 0
stdout
120
35
1417