#include <bits/stdc++.h>
using namespace std;
int main() {
int h1,h2,m1,m2;
cin>>h1>>m1>>h2>>m2;
if((h1,h2,m1,m2)!=0){
if(h1==0)h1=24;
if(h2==0)h2=24;
if(h2>h1)
{
if(m2>m1)
cout<<(h2-h1)*60+(m2-m1);
else
cout<<((m2-m1)+60)+((h2-1)-h1)*60;
}
if(h2<=h1)
{
if(m2>m1)
cout<<((h2-h1)+24)*60+(m2-m1);
else
cout<<((m2-m1)+60)+(((h2-1)-h1)+24)*60;
}
}
return 0;
}
if((h1,h2,m1,m2)!=0){
if(h2<=h1)
{
if(m2>m1)
cout<<((h2-h1)+24)*60+(m2-m1);
else
cout<<((m2-m1)+60)+(((h2-1)-h1)+24)*60;
}
1. 輸入含有多筆測資
2. if((h1,h2,m1,m2)!=0)這樣子只會判斷m2是否為0,建議可以改成if((h1+h2+m1+m2)!=0)
3. h2==h1且m2>m1時會出錯