-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path1103.cpp
39 lines (34 loc) · 1011 Bytes
/
1103.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
#include<math.h>
int main (){
int h1, m1, h2, m2;
int hf, mf, res;
while (scanf("%d %d %d %d", &h1, &m1, &h2, &m2),(h1 != 0) || (m1 !=0) || (h2 !=0) || (m2!=0)){
if ( m2>m1 && h1==h2 ){
res = m2-m1;
}else{
if ( m1>m2 && h1==h2 ){
res = 1440-(m1-m2);
}else{
if ( h1>h2 ){
res = (h1-h2)*60;
res = 1440-res;
if ( m1>m2 ){
res = res-(m1-m2);
}else{
res = res + (m2-m1);
}
}else{
res = (h2-h1)*60;
if ( m1>m2 ){
res = res - (m1-m2);
}else{
res = res + (m2-m1);
}
}
}
}
printf ("%d\n", res);
}
return 0;
}