#20184: C++轉Python


infa10718@kyicvs.khc.edu.tw (我部會Python)

School : No School
ID : 112393
IP address : [210.60.110.198]
Last Login :
2019-12-12 11:20:46
a111. 12149 - Feynman -- UVa12149 | From: [210.60.110.198] | Post Date : 2019-12-12 11:30

#include<cstdio>

int main(void)
{
int H1,M1,H2,M2;
while(scanf("%d%d%d%d",&H1,&M1,&H2,&M2)!=EOF)
{
int a = 0, b = 0;
if(H2 > H1)
a = H2 - H1;
else
a = 24 - H1 + H2;
if(M2 >= M1)
b = M2 - M1;
else
{
a = a -1;
b = 60 - M1 + M2;
}
if(H1 == H2)
{
if(M1 > M2)
a = 23;
else
a = 0;
}

printf("%d %d\n",a,b);
}
return 0;
}

 
ZeroJudge Forum